annotate os2/dw.c @ 1547:2fd9ff675d79

Added autosize code for the MLE on OS/2... Using the max for container and tree on OS/2 right now... Figuring out the space requirements for the container is very complicated.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 13 Jan 2012 17:03:24 +0000
parents 1fd3a9635c4d
children ef7959aae8da
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
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
51 #ifdef __IBMC__
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
52 #define API_FUNC * API
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
53 #else
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
54 #define API_FUNC API *
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
55 #endif
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
56
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
57 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
58 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
59 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
60 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
61 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
62 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height);
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
63 void _free_menu_data(HWND menu);
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
64 ULONG (API_FUNC _PmPrintfString)(char *String) = 0;
1495
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
65 BOOL (API_FUNC _WinQueryDesktopWorkArea)(HWND hwndDesktop, PWRECT pwrcWorkArea) = 0;
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
66
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
67 char ClassName[] = "dynamicwindows";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
68 char SplitbarClassName[] = "dwsplitbar";
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
69 char ScrollClassName[] = "dwscroll";
1534
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
70 char CalendarClassName[] = "dwcalendar";
360
cf66410d03b4 Use 8.Helv as the default font before Warp 4.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 356
diff changeset
71 char *DefaultFont = "9.WarpSans";
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
72
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
73 HAB dwhab = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
74 HMQ dwhmq = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
75 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
76 LONG _foreground = 0xAAAAAA, _background = DW_CLR_DEFAULT;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
77
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
78 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
79 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
80
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
81 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
82 ULONG aulBuffer[4];
190
f4c9fa77136a A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 185
diff changeset
83 HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop;
1495
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
84 HMOD wpconfig = 0, pmprintf = 0, pmmerge = 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
85 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
86
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
87 unsigned long _colors[] = {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
88 CLR_BLACK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
89 CLR_DARKRED,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
90 CLR_DARKGREEN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
91 CLR_BROWN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
92 CLR_DARKBLUE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
93 CLR_DARKPINK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
94 CLR_DARKCYAN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
95 CLR_PALEGRAY,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
96 CLR_DARKGRAY,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
97 CLR_RED,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
98 CLR_GREEN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
99 CLR_YELLOW,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
100 CLR_BLUE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
101 CLR_PINK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
102 CLR_CYAN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
103 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
104 };
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
105
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
106 #define DW_OS2_NEW_WINDOW 1
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
107
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
108 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
109
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
110 #ifndef min
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
111 #define min(a, b) (((a < b) ? a : b))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
112 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
113
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
114 typedef struct _sighandler
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
115 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
116 struct _sighandler *next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
117 ULONG message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
118 HWND window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
119 int id;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
120 void *signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
121 void *data;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
122
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
123 } SignalHandler;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
124
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
125 SignalHandler *Root = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
126
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
127 typedef struct
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
128 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
129 ULONG message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
130 char name[30];
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
131
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
132 } SignalList;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
133
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
134 /* 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
135 #define SIGNALMAX 16
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
136
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
137 SignalList SignalTranslate[SIGNALMAX] = {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
138 { WM_SIZE, DW_SIGNAL_CONFIGURE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
139 { WM_CHAR, DW_SIGNAL_KEY_PRESS },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
140 { WM_BUTTON1DOWN, DW_SIGNAL_BUTTON_PRESS },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
141 { WM_BUTTON1UP, DW_SIGNAL_BUTTON_RELEASE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
142 { WM_MOUSEMOVE, DW_SIGNAL_MOTION_NOTIFY },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
143 { WM_CLOSE, DW_SIGNAL_DELETE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
144 { WM_PAINT, DW_SIGNAL_EXPOSE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
145 { WM_COMMAND, DW_SIGNAL_CLICKED },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
146 { CN_ENTER, DW_SIGNAL_ITEM_ENTER },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
147 { CN_CONTEXTMENU, DW_SIGNAL_ITEM_CONTEXT },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
148 { LN_SELECT, DW_SIGNAL_LIST_SELECT },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
149 { CN_EMPHASIS, DW_SIGNAL_ITEM_SELECT },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
150 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
151 { SLN_SLIDERTRACK, DW_SIGNAL_VALUE_CHANGED },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
152 { BKN_PAGESELECTED,DW_SIGNAL_SWITCH_PAGE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
153 { CN_EXPANDTREE, DW_SIGNAL_TREE_EXPAND }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
154 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
155
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
156 /* 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
157 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
158 {
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
159 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
160
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
161 GlobalID++;
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
162 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
163 {
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
164 GlobalID = 10000;
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
165 }
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
166 return GlobalID;
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
167 }
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
168
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
169 /* This function adds a signal handler callback into the linked list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
170 */
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
171 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
172 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
173 SignalHandler *new = malloc(sizeof(SignalHandler));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
174
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
175 new->message = message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
176 new->window = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
177 new->id = id;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
178 new->signalfunction = signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
179 new->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
180 new->next = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
181
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
182 if (!Root)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
183 Root = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
184 else
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 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
187 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
188 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
189 if(tmp->message == message &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
190 tmp->window == window &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
191 tmp->id == id &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
192 tmp->signalfunction == signalfunction)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
193 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
194 tmp->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
195 free(new);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
196 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
197 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
198 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
199 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
200 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
201 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
202 prev->next = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
203 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
204 Root = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
205 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
206 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
207
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
208 /* Finds the message number for a given signal name */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
209 ULONG _findsigmessage(char *signame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
210 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
211 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
212
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
213 for(z=0;z<SIGNALMAX;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
214 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
215 if(stricmp(signame, SignalTranslate[z].name) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
216 return SignalTranslate[z].message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
217 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
218 return 0L;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
219 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
220
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
221 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
222 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
223 MINIRECORDCORE rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
224 HPOINTER hptrIcon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
225 PVOID user;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
226 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
227
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
228 } 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
229
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
230
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
231 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
232 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
233 window = window; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
234 key = key; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
235 data = data; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
236 return TRUE;
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
237 }
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
238
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
239 /* Internal function to queue a window redraw */
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
240 void _dw_redraw(HWND window, int skip)
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
241 {
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
242 static HWND lastwindow = 0;
1425
1628bf383893 Changes to _dw_redraw() to prevent infinite recursion on OS/2, Win and Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1424
diff changeset
243 HWND redraw = lastwindow;
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
244
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
245 if(skip && !window)
1425
1628bf383893 Changes to _dw_redraw() to prevent infinite recursion on OS/2, Win and Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1424
diff changeset
246 return;
1628bf383893 Changes to _dw_redraw() to prevent infinite recursion on OS/2, Win and Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1424
diff changeset
247
1628bf383893 Changes to _dw_redraw() to prevent infinite recursion on OS/2, Win and Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1424
diff changeset
248 lastwindow = window;
1628bf383893 Changes to _dw_redraw() to prevent infinite recursion on OS/2, Win and Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1424
diff changeset
249 if(redraw != lastwindow && redraw)
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
250 {
1425
1628bf383893 Changes to _dw_redraw() to prevent infinite recursion on OS/2, Win and Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1424
diff changeset
251 dw_window_redraw(redraw);
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
252 }
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
253 }
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
254
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
255 /* 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
256 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
257 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
258 HWND box, lastbox = WinQueryWindow(handle, QW_PARENT);
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 /* Find the toplevel window */
1466
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
261 while((box = WinQueryWindow(lastbox, QW_PARENT)) != desktop && box)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
262 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
263 lastbox = box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
264 }
1466
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
265 if(box)
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
266 {
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
267 char tmpbuf[100] = {0};
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
268
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
269 WinQueryClassName(lastbox, 99, (PCH)tmpbuf);
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
270 if(strncmp(tmpbuf, "#1", 3) == 0)
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
271 return lastbox;
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
272 }
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
273 return NULLHANDLE;
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
274 }
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
275
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
276
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
277 /* 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
278 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
279 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
280 unsigned long height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
281 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
282 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
283 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
284
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
285 /* 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
286 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
287 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
288 while(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
289 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
290 HWND client;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
291 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
292 {
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
293 return _get_height(WinQueryWindow(handle, QW_PARENT));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
294 }
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
295 handle = WinQueryWindow(handle, QW_PARENT);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
296 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
297 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
298 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
299
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
300 /* 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
301 * 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
302 */
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
303 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
304 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
305 MRESULT res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
306 int z = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
307
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
308 while((int)(res = WinSendMsg(hwnd, msg, mp1, mp2)) == failure)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
309 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
310 z++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
311 if(z > 5000000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
312 return (MRESULT)failure;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
313 dw_main_sleep(1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
314 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
315 return res;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
316 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
317
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
318 /* 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
319 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
320 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
321 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
322 }
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
323
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
324 /* Return the entryfield child of a window */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
325 HWND _find_entryfield(HWND handle)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
326 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
327 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
328 HWND child, entry = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
329
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
330 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
331 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
332 {
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
333 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
334
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
335 WinQueryClassName(child, 99, (PCH)tmpbuf);
643
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 if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */
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 entry = child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
340 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
341 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
342 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
343 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
344 return entry;
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
345 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
346
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
347 /* 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
348 * 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
349 */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
350 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
351 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
352 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
353 HWND child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
354
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
355 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
356 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
357 {
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
358 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
359
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
360 WinQueryClassName(child, 99, (PCH)tmpbuf);
643
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(strncmp(tmpbuf, "#3", 3)==0 && dw) /* Button */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
363 WinSetOwner(child, dw);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
364 else if(strncmp(tmpbuf, "dynamicwindows", 14) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
365 dw = child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
366
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
367 _fix_button_owner(child, dw);
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 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
370 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
371 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
372
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
373 /* 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
374 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
375 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
376 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
377 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
378 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
379 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
380 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
381 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
382
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
383 if(icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
384 WinDestroyPointer(icon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
385
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
386 if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
387 dw_pixmap_destroy(pixmap);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
388
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
389 if(disable)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
390 dw_pixmap_destroy(disable);
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 if(hps)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
393 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
394 GpiSetBitmap(hps, NULLHANDLE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
395 GpiAssociate(hps, NULLHANDLE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
396 GpiDestroyPS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
397 }
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 if(hdc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
400 DevCloseDC(hdc);
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 if(hbm)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
403 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
404 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
405
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
406 /* This function removes any handlers on windows and frees
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
407 * the user memory allocated to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
408 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
409 void _free_window_memory(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
410 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
411 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
412 HWND child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
413 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
414
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
415 dw_signal_disconnect_by_window(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
416
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
417 if((child = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
418 _free_menu_data(child);
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((child = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
421 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
422 Box *box = (Box *)WinQueryWindowPtr(child, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
423
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
424 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
425 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
426 if(box->count && box->items)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
427 free(box->items);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
428
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
429 WinSetWindowPtr(child, QWP_USER, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
430 free(box);
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
433
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
434 if(ptr)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
435 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
436 WindowData *wd = (WindowData *)ptr;
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
437 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
438
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
439 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
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 if(strncmp(tmpbuf, "ColorSelectClass", 17)!=0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
442 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
443 /* If this window has an associate bitmap destroy it. */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
444 _free_bitmap(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
445
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
446 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
447 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
448 Box *box = (Box *)ptr;
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 if(box->count && box->items)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
451 free(box->items);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
452 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
453 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
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 void *data = dw_window_get_data(handle, "_dw_percent");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
456
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
457 if(data)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
458 free(data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
459 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
460 else if(strncmp(tmpbuf, "#37", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
461 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
462 dw_container_clear(handle, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
463 if(wd && dw_window_get_data(handle, "_dw_container"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
464 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
465 void *oldflags = wd->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
466
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
467 wd->data = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
468 free(oldflags);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
469 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
470 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
471
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
472 if(wd->oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
473 WinSubclassWindow(handle, wd->oldproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
474
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
475 dw_window_set_data(handle, NULL, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
476 WinSetWindowPtr(handle, QWP_USER, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
477 free(ptr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
478 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
479 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
480
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
481 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
482 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
483 _free_window_memory(child);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
484
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
485 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
486 return;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
487 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
488
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
489 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
490 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
491 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
492
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
493 dw_signal_disconnect_by_name(menu, DW_SIGNAL_CLICKED);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
494 _free_window_memory(menu);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
495
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
496 for(i=0;i<count;i++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
497 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
498 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
499 MENUITEM mi;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
500
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
501 /* 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
502 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
503 {
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
504 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
505
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
506 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
507 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
508 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
509 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
510 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
511 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
512 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
513 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
514 }
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
515
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
516 /* Check any submenus */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
517 if(WinSendMsg(menu, MM_QUERYITEM, MPFROMSHORT(menuid), MPFROMP(&mi))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
518 && mi.hwndSubMenu)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
519 _free_menu_data(mi.hwndSubMenu);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
520 }
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
521 }
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
522
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
523 /* This function returns 1 if the window (widget) handle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
524 * passed to it is a valid window that can gain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
525 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
526 int _validate_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
527 {
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
528 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
529
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
530 if(!handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
531 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
532
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
533 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
534
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
535 if(!WinIsWindowEnabled(handle) ||
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
536 (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
537 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
538
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
539 /* These are the window classes which can
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
540 * obtain input focus.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
541 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
542 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
543 strncmp(tmpbuf, "#3", 3)==0 || /* Button */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
544 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
545 strncmp(tmpbuf, "#7", 3)==0 || /* List box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
546 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
547 strncmp(tmpbuf, "#32", 4)==0 || /* Spinbutton */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
548 strncmp(tmpbuf, "#37", 4)==0 || /* Container */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
549 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
550 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
551 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
552 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
553
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
554 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
555 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
556 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
557 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
558 static int finish_searching;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
559
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
560 /* Start is 2 when we have cycled completely and
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
561 * 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
562 * that was valid.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
563 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
564 if(start == 2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
565 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
566 if(lasthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
567 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
568 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
569 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
570
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
571 /* Start is 1 when we are entering the function
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
572 * for the first time, it is zero when entering
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
573 * the function recursively.
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(start == 1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
576 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
577 lasthwnd = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
578 finish_searching = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
579 firsthwnd = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
580 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
581
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
582 for(z=box->count-1;z>-1;z--)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
583 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
584 if(box->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
585 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
586 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
587
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
588 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
589 return 1;
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
592 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
593 if(box->items[z].hwnd == handle)
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 if(lasthwnd == handle && firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
596 WinSetFocus(HWND_DESKTOP, firsthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
597 else if(lasthwnd == handle && !firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
598 finish_searching = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
599 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
600 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
601
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
602 /* If we aren't looking for the last handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
603 * return immediately.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
604 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
605 if(!finish_searching)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
606 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
607 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
608 if(_validate_focus(box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
609 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
610 /* Start is 3 when we are looking for the
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
611 * first valid item in the layout.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
612 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
613 if(start == 3)
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 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
616 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
617 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
618 return 1;
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 }
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(!firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
623 firsthwnd = box->items[z].hwnd;
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 lasthwnd = box->items[z].hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
626 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
627 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
628 {
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
629 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
630
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
631 WinQueryClassName(box->items[z].hwnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
632 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
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 /* Then try the bottom or right box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
635 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
636
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
637 if(mybox)
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 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
640
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
641 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
642 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
643 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
644
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
645 /* Try the top or left box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
646 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
647
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
648 if(mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
649 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
650 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
651
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
652 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
653 return 1;
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 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
657 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
658 Box *notebox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
659 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
660 (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
661
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
662 if(page)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
663 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
664 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
665
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
666 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
667 return 1;
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 }
904
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
670 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
671 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
672 /* 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
673 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
674
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
675 if(mybox)
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
676 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
677 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
678
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
679 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
680 return 1;
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
681 }
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
682 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
683 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
684 }
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 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
687 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
688
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
689 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
690 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
691 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
692 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
693 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
694
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
695 /* Start is 2 when we have cycled completely and
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
696 * 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
697 * that was valid.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
698 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
699 if(start == 2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
700 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
701 if(lasthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
702 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
703 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
704 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
705
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
706 /* Start is 1 when we are entering the function
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
707 * for the first time, it is zero when entering
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
708 * the function recursively.
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(start == 1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
711 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
712 lasthwnd = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
713 finish_searching = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
714 firsthwnd = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
715 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
716
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
717 for(z=0;z<box->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
718 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
719 if(box->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
720 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
721 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
722
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
723 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
724 return 1;
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
727 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
728 if(box->items[z].hwnd == handle)
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 if(lasthwnd == handle && firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
731 WinSetFocus(HWND_DESKTOP, firsthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
732 else if(lasthwnd == handle && !firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
733 finish_searching = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
734 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
735 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
736
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
737 /* If we aren't looking for the last handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
738 * return immediately.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
739 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
740 if(!finish_searching)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
741 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
742 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
743 if(_validate_focus(box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
744 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
745 /* Start is 3 when we are looking for the
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
746 * first valid item in the layout.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
747 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
748 if(start == 3)
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 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
751 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
752 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
753 return 1;
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 }
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(!firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
758 firsthwnd = box->items[z].hwnd;
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 lasthwnd = box->items[z].hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
761 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
762 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
763 {
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
764 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
765
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
766 WinQueryClassName(box->items[z].hwnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
767 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
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 /* Try the top or left box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
770 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
771
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
772 if(mybox)
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 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
775
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
776 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
777 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
778 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
779
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
780 /* Then try the bottom or right box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
781 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
782
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
783 if(mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
784 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
785 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
786
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
787 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
788 return 1;
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 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
792 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
793 Box *notebox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
794 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
795 (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
796
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
797 if(page)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
798 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
799 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
800
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
801 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
802 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
803 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
804 }
904
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
805 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
806 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
807 /* 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
808 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
809
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
810 if(mybox)
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
811 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
812 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
813
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
814 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
815 return 1;
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
816 }
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
817 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
818 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
819 }
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 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
822 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
823
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
824 /* This function finds the first widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
825 * layout and moves the current focus to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
826 */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
827 int _initial_focus(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
828 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
829 Box *thisbox = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
830 HWND box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
831
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
832 box = WinWindowFromID(handle, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
833 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
834 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
835 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
836 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
837
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
838 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
839 _focus_check_box(thisbox, handle, 3, thisbox->defaultitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
840 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
841 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
842
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
843 /* This function finds the current widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
844 * layout and moves the current focus to the next item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
845 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
846 void _shift_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
847 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
848 Box *thisbox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
849 HWND box, lastbox = _toplevel_window(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
850
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
851 box = WinWindowFromID(lastbox, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
852 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
853 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
854 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
855 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
856
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
857 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
858 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
859 if(_focus_check_box(thisbox, handle, 1, 0) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
860 _focus_check_box(thisbox, handle, 2, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
861 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
862 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
863
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
864 /* 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
865 * 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
866 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
867 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
868 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
869 Box *thisbox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
870 HWND box, lastbox = _toplevel_window(handle);
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 box = WinWindowFromID(lastbox, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
873 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
874 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
875 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
876 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
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 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
879 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
880 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
881 _focus_check_box_back(thisbox, handle, 2, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
882 }
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
883 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
884
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
885 /* This function will recursively search a box and add up the total height of it */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
886 void _count_size(HWND box, int type, int *xsize, int *xorigsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
887 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
888 int size = 0, origsize = 0, z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
889 Box *tmp = WinQueryWindowPtr(box, QWP_USER);
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(!tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
892 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
893 *xsize = *xorigsize = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
894 return;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
897 if(type == tmp->type)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
898 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
899 /* 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
900 * return the entire sum of the items.
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 for(z=0;z<tmp->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
903 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
904 if(tmp->items[z].type == TYPEBOX)
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 int s, os;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
907
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
908 _count_size(tmp->items[z].hwnd, type, &s, &os);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
909 size += s;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
910 origsize += os;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
911 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
912 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
913 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
914 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
915 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
916 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
917 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
918 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
919 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
920 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
921 /* 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
922 * want to return the maximum value.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
923 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
924 int tmpsize = 0, tmporigsize = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
925
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
926 for(z=0;z<tmp->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
927 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
928 if(tmp->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
929 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
930 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
931 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
932 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
933 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
934 }
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(tmpsize > size)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
937 size = tmpsize;
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 }
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 *xsize = size;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
942 *xorigsize = origsize;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
943 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
944
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
945
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
946 /* Function: TrackRectangle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
947 * Abstract: Tracks given rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
948 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
949 * If rclBounds is NULL, then track rectangle on entire desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
950 * rclTrack is in window coorditates and will be mapped to
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
951 * desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
952 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
953
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
954 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
955 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
956 TRACKINFO track;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
957 APIRET rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
958
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
959 track.cxBorder = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
960 track.cyBorder = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
961 track.cxGrid = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
962 track.cyGrid = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
963 track.cxKeyboard = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
964 track.cyKeyboard = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
965
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
966 if(!rclTrack)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
967 return FALSE;
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 if(rclBounds)
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 track.rclBoundary = *rclBounds;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
972 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
973 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
974 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
975 track.rclBoundary.yTop =
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
976 track.rclBoundary.xRight = 3000;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
977 track.rclBoundary.yBottom =
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
978 track.rclBoundary.xLeft = -3000;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
979 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
980
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
981 track.rclTrack = *rclTrack;
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 WinMapWindowPoints(hwndBase,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
984 HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
985 (PPOINTL)&track.rclTrack,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
986 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
987
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
988 track.ptlMinTrackSize.x = track.rclTrack.xRight
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
989 - track.rclTrack.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
990 track.ptlMinTrackSize.y = track.rclTrack.yTop
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
991 - track.rclTrack.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
992 track.ptlMaxTrackSize.x = track.rclTrack.xRight
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
993 - track.rclTrack.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
994 track.ptlMaxTrackSize.y = track.rclTrack.yTop
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
995 - track.rclTrack.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
996
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
997 track.fs = TF_MOVE | TF_ALLINBOUNDARY;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
998
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
999 rc = WinTrackRect(HWND_DESKTOP, 0, &track);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1000
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1001 if(rc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1002 *rclTrack = track.rclTrack;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1003
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1004 return rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1005 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1006
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1007 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
1008 {
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
1009 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1010
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
1011 WinQueryClassName(hwnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1012
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1013 /* 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
1014 if(strncmp(tmpbuf, "#40", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1015 {
822
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
1016 long x, y;
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
1017 unsigned long width, height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1018 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
1019
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1020 while(page)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1021 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1022 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
1023 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1024
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1025 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1026 if(pagebox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1027 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1028 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
1029
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1030 rc.xLeft = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1031 rc.yBottom = y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1032 rc.xRight = x + width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1033 rc.yTop = y + height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1034
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1035 WinSendMsg(hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1036
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1037 _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
1038 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1039 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
1040 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1041
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1042 }
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1043 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1044
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
1045 /* 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
1046 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
1047 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1048 if(color < 16)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1049 return _colors[color];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1050 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
1051 }
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
1052
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
1053 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
1054 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1055 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
1056 }
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
1057
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1058 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
1059 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1060 int height = _get_height(parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1061
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1062 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
1063 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1064
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1065 /* This function calculates how much space the widgets and boxes require
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1066 * and does expansion as necessary.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1067 */
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1068 static void _resize_box(Box *thisbox, int *depth, int x, int y, int pass)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1069 {
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1070 /* Current item position */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1071 int z, currentx = thisbox->pad, currenty = thisbox->pad;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1072 /* Used x, y and padding maximum values...
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1073 * These will be used to find the widest or
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1074 * tallest items in a box.
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1075 */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1076 int uymax = 0, uxmax = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1077 int upymax = 0, upxmax = 0;
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1078
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1079 /* Reset the box sizes */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1080 thisbox->minwidth = thisbox->minheight = thisbox->usedpadx = thisbox->usedpady = thisbox->pad * 2;
643
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 if(thisbox->grouphwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1083 {
1442
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1084 /* Only calculate the size on the first pass...
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1085 * use the cached values on second.
1409
93eb987c05cf Same basic groupbox fix for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1407
diff changeset
1086 */
1442
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1087 if(pass == 1)
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1088 {
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1089 char *text = dw_window_get_text(thisbox->grouphwnd);
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1090
1409
93eb987c05cf Same basic groupbox fix for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1407
diff changeset
1091 thisbox->grouppady = 9;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1092
1442
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1093 if(text)
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1094 {
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1095 if(*text)
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1096 dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady);
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1097 dw_free(text);
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1098 }
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1099 /* If the string height is less than 9...
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1100 * set it to 9 anyway since that is the minimum.
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1101 */
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1102 if(thisbox->grouppady < 9)
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1103 thisbox->grouppady = 9;
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1104
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1105 if(thisbox->grouppady)
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1106 thisbox->grouppady += 3;
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1107 else
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1108 thisbox->grouppady = 6;
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1109
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1110 thisbox->grouppadx = 6;
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1111 }
02a329b2b0cd Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1439
diff changeset
1112
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1113 thisbox->minwidth += thisbox->grouppadx;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1114 thisbox->usedpadx += thisbox->grouppadx;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1115 thisbox->minheight += thisbox->grouppady;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1116 thisbox->usedpady += thisbox->grouppady;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1117 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1118
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1119 /* Count up all the space for all items in the box */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1120 for(z=0;z<thisbox->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1121 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1122 int itempad, itemwidth, itemheight;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1123
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1124 if(thisbox->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1125 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1126 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
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 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1129 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1130 /* On the first pass calculate the box contents */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1131 if(pass == 1)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1132 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1133 (*depth)++;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1134
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1135 /* Save the newly calculated values on the box */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1136 _resize_box(tmp, depth, x, y, pass);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1137
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1138 /* Duplicate the values in the item list for use below */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1139 thisbox->items[z].width = tmp->minwidth;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1140 thisbox->items[z].height = tmp->minheight;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1141
1449
632346743f46 Fixed dw_window_redraw() on Windows not recalculating notebook page contents if the notebook size didn't change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1445
diff changeset
1142 /* If the box has no contents but is expandable... default the size to 1 */
632346743f46 Fixed dw_window_redraw() on Windows not recalculating notebook page contents if the notebook size didn't change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1445
diff changeset
1143 if(!thisbox->items[z].width && thisbox->items[z].hsize)
632346743f46 Fixed dw_window_redraw() on Windows not recalculating notebook page contents if the notebook size didn't change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1445
diff changeset
1144 thisbox->items[z].width = 1;
632346743f46 Fixed dw_window_redraw() on Windows not recalculating notebook page contents if the notebook size didn't change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1445
diff changeset
1145 if(!thisbox->items[z].height && thisbox->items[z].vsize)
632346743f46 Fixed dw_window_redraw() on Windows not recalculating notebook page contents if the notebook size didn't change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1445
diff changeset
1146 thisbox->items[z].height = 1;
632346743f46 Fixed dw_window_redraw() on Windows not recalculating notebook page contents if the notebook size didn't change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1445
diff changeset
1147
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1148 (*depth)--;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1149 }
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1150 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1151 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1152
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1153 /* Precalculate these values, since they will
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1154 * be used used repeatedly in the next section.
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1155 */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1156 itempad = thisbox->items[z].pad * 2;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1157 itemwidth = thisbox->items[z].width + itempad;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1158 itemheight = thisbox->items[z].height + itempad;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1159
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1160 /* Calculate the totals and maximums */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1161 if(thisbox->type == DW_VERT)
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 if(itemwidth > uxmax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1164 uxmax = itemwidth;
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1165
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1166 if(thisbox->items[z].hsize != SIZEEXPAND)
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 if(itemwidth > upxmax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1169 upxmax = itemwidth;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1170 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1171 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1172 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1173 if(itempad > upxmax)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1174 upxmax = itempad;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1175 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1176 thisbox->minheight += itemheight;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1177 if(thisbox->items[z].vsize != SIZEEXPAND)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1178 thisbox->usedpady += itemheight;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1179 else
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1180 thisbox->usedpady += itempad;
643
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1183 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1184 if(itemheight > uymax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1185 uymax = itemheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1186 if(thisbox->items[z].vsize != SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1187 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1188 if(itemheight > upymax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1189 upymax = itemheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1190 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1191 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1192 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1193 if(itempad > upymax)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1194 upymax = itempad;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1195 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1196 thisbox->minwidth += itemwidth;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1197 if(thisbox->items[z].hsize != SIZEEXPAND)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1198 thisbox->usedpadx += itemwidth;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1199 else
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1200 thisbox->usedpadx += itempad;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1201 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1202 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1203
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1204 /* Add the maximums which were calculated in the previous loop */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1205 thisbox->minwidth += uxmax;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1206 thisbox->minheight += uymax;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1207 thisbox->usedpadx += upxmax;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1208 thisbox->usedpady += upymax;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1209
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1210 /* Move the groupbox start past the group border */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1211 if(thisbox->grouphwnd)
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 currentx += 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1214 currenty += thisbox->grouppady - 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1215 }
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1216
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1217 /* The second pass is for actual placement. */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1218 if(pass > 1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1219 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1220 for(z=0;z<(thisbox->count);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1221 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1222 int height = thisbox->items[z].height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1223 int width = thisbox->items[z].width;
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1224 int itempad = thisbox->items[z].pad * 2;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1225 int thispad = thisbox->pad * 2;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1226
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1227 /* Calculate the new sizes */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1228 if(thisbox->items[z].hsize == SIZEEXPAND)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1229 {
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1230 if(thisbox->type == DW_HORZ)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1231 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1232 int expandablex = thisbox->minwidth - thisbox->usedpadx;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1233
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1234 if(expandablex)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1235 width = (int)(((float)width / (float)expandablex) * (float)(x - thisbox->usedpadx));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1236 }
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1237 else
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1238 width = x - (itempad + thispad + thisbox->grouppadx);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1239 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1240 if(thisbox->items[z].vsize == SIZEEXPAND)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1241 {
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1242 if(thisbox->type == DW_VERT)
1436
18c1b999dd65 Similar fix for OS/2 and Windows as just committed on Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1434
diff changeset
1243 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1244 int expandabley = thisbox->minheight - thisbox->usedpady;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1245
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1246 if(expandabley)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1247 height = (int)(((float)height / (float)expandabley) * (float)(y - thisbox->usedpady));
1436
18c1b999dd65 Similar fix for OS/2 and Windows as just committed on Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1434
diff changeset
1248 }
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1249 else
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1250 height = y - (itempad + thispad + thisbox->grouppady);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1251 }
1455
a56fa83f2a7c Remove forcing of items packed into toplevel windows to expand on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1449
diff changeset
1252
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1253 /* If the calculated size is valid... */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1254 if(width > 0 && height > 0)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1255 {
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1256 int pad = thisbox->items[z].pad;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1257 HWND handle = thisbox->items[z].hwnd;
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
1258 char tmpbuf[100] = {0};
1436
18c1b999dd65 Similar fix for OS/2 and Windows as just committed on Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1434
diff changeset
1259
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
1260 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1261
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1262 if(strncmp(tmpbuf, "#2", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1263 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1264 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
1265 /* Make the combobox big enough to drop down. :) */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1266 WinSetWindowPos(handle, HWND_TOP, 0, -100,
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1267 width, height + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1268 _MySetWindowPos(frame, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1269 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
643
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 else if(strncmp(tmpbuf, "#6", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1272 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1273 /* 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
1274 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3,
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1275 width - 6, height - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1276 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1277 else if(strncmp(tmpbuf, "#40", 5)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1278 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1279 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1280 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1281 _check_resize_notebook(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1282 }
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1283 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
1284 {
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1285 /* Handle special case of scrollbox */
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1286 int cx, cy, depth = 0;
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1287 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
1288 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
1289 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
1290 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
1291 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
1292 int origx, origy;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1293 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
1294 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
1295
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1296 /* Position the scrollbox parts */
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1297 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
1445
8f7692fcad37 Use system metrics/values to get the scrollbar sizes on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1444
diff changeset
1298 WinSetWindowPos(client, HWND_TOP, 0, WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER);
8f7692fcad37 Use system metrics/values to get the scrollbar sizes on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1444
diff changeset
1299 WinSetWindowPos(hscroll, HWND_TOP, 0, 0, width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER);
8f7692fcad37 Use system metrics/values to get the scrollbar sizes on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1444
diff changeset
1300 WinSetWindowPos(vscroll, HWND_TOP, width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL), height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL), SWP_MOVE | SWP_SIZE | SWP_ZORDER);
8f7692fcad37 Use system metrics/values to get the scrollbar sizes on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1444
diff changeset
1301
8f7692fcad37 Use system metrics/values to get the scrollbar sizes on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1444
diff changeset
1302 origx = cx = width - WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL);
8f7692fcad37 Use system metrics/values to get the scrollbar sizes on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1444
diff changeset
1303 origy = cy = height - WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL);
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1304
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1305 /* Get the required space for the box */
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1306 _resize_box(contentbox, &depth, cx, cy, 1);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1307
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1308 if(cx < contentbox->minwidth)
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1309 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1310 cx = contentbox->minwidth;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1311 }
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1312 if(cy < contentbox->minheight)
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1313 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1314 cy = contentbox->minheight;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1315 }
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1316
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1317 /* Setup vertical scroller */
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1318 WinSendMsg(vscroll, SBM_SETSCROLLBAR, (MPARAM)vpos, MPFROM2SHORT(0, (unsigned short)contentbox->minheight - origy));
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1319 WinSendMsg(vscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)origy, contentbox->minheight), 0);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1320 if(vpos > contentbox->minheight)
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1321 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1322 vpos = contentbox->minheight;
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1323 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
1324 }
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
1325
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1326 /* Setup horizontal scroller */
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1327 WinSendMsg(hscroll, SBM_SETSCROLLBAR, (MPARAM)hpos, MPFROM2SHORT(0, (unsigned short)contentbox->minwidth - origx));
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1328 WinSendMsg(hscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)origx, contentbox->minwidth), 0);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1329 if(hpos > contentbox->minwidth)
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1330 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1331 hpos = contentbox->minwidth;
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1332 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
1333 }
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
1334
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1335 /* 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
1336 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
1337
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
1338 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
1339
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1340 /* 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
1341 _do_resize(contentbox, cx, cy);
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1342 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1343 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1344 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1345 /* Then try the bottom or right box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1346 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
1347 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
1348
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1349 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1350 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1351
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1352 if(percent)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1353 _handle_splitbar_resize(handle, *percent, type, width, height);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1354 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1355 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1356 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1357 /* Everything else */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1358 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1359 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1360
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1361 /* After placing a box... place its components */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1362 if(thisbox->items[z].type == TYPEBOX)
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 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1365
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1366 if(boxinfo)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1367 {
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1368 if(boxinfo->grouphwnd)
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1369 {
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1370 /* Move the group border into place */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1371 WinSetWindowPos(boxinfo->grouphwnd, HWND_TOP, 0, 0,
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1372 width, height, SWP_MOVE | SWP_SIZE);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1373 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1374 /* Dive into the box */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1375 (*depth)++;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1376 _resize_box(boxinfo, depth, width, height, pass);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1377 (*depth)--;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1378 }
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1381
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1382 /* Advance the current position in the box */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1383 if(thisbox->type == DW_HORZ)
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1384 currentx += width + (pad * 2);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1385 if(thisbox->type == DW_VERT)
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1386 currenty += height + (pad * 2);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1387 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1388 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1389 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1390 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1391
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1392 void _do_resize(Box *thisbox, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1393 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1394 if(x != 0 && y != 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1395 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1396 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1397 {
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1398 int depth = 0;
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1399
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1400 /* Calculate space requirements */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1401 _resize_box(thisbox, &depth, x, y, 1);
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1402
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1403 /* Finally place all the boxes and controls */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1404 _resize_box(thisbox, &depth, x, y, 2);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1405 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1406 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1407 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1408
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1409 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1410 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1411 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1412 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1413 Box *thisbox = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1414 HWND box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1415
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1416 box = WinWindowFromID(hWnd, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1417 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1418 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1419
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1420 if(thisbox && !thisbox->titlebar)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1421 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1422 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1423 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1424 case WM_QUERYTRACKINFO:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1425 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1426 if(blah && *blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1427 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1428 PTRACKINFO ptInfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1429 int res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1430 PFNWP myfunc = *blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1431 res = (int)myfunc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1432
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1433 ptInfo = (PTRACKINFO)(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1434
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1435 ptInfo->ptlMinTrackSize.y = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1436 ptInfo->ptlMinTrackSize.x = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1437
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1438 return (MRESULT)res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1439 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1440 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1441 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1442 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1443
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1444 if(blah && *blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1445 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1446 PFNWP myfunc = *blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1447 return myfunc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1448 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1449
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1450 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1451 }
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1452
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1453 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
1454 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1455 POINTL ptl1, ptl2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1456
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1457 ptl1.x = rclPaint.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1458 ptl2.y = ptl1.y = rclPaint.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1459 ptl2.x = rclPaint.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1460 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1461 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
1462 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1463
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1464 /* 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
1465 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
1466 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1467 POINTL ptl1, ptl2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1468
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1469 ptl2.x = ptl1.x = rclPaint.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1470 ptl1.y = rclPaint.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1471 ptl2.y = rclPaint.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1472 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1473 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
1474 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1475
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1476 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
1477 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1478 POINTL ptl1, ptl2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1479
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1480 ptl1.x = rclPaint.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1481 ptl1.y = ptl2.y = rclPaint.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1482 ptl2.x = rclPaint.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1483 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1484 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
1485 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1486
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1487 /* 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
1488 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
1489 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1490 POINTL ptl1, ptl2;
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 ptl2.x = ptl1.x = rclPaint.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1493 ptl1.y = rclPaint.yBottom + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1494 ptl2.y = rclPaint.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1495 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1496 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
1497 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1498
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1499
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1500 /* Function: BubbleProc
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1501 * Abstract: Subclass procedure for bubble help
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1502 */
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1503 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1504 {
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1505 MRESULT res;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1506 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1507
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1508 if(proc)
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1509 res = proc(hwnd, msg, mp1, mp2);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1510 else
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1511 res = WinDefWindowProc(hwnd, msg, mp1, mp2);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1512
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1513 if(msg == WM_PAINT)
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1514 {
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1515 POINTL ptl;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1516 HPS hpsTemp;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1517 RECTL rcl;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1518 int height, width;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1519
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1520 WinQueryWindowRect(hwnd, &rcl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1521 height = rcl.yTop - rcl.yBottom - 1;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1522 width = rcl.xRight - rcl.xLeft - 1;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1523
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1524 /* Draw a border around the bubble help */
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1525 hpsTemp = WinGetPS(hwnd);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1526 GpiSetColor(hpsTemp, CLR_BLACK);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1527 ptl.x = ptl.y = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1528 GpiMove(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1529 ptl.x = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1530 ptl.y = height;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1531 GpiLine(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1532 ptl.x = ptl.y = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1533 GpiMove(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1534 ptl.y = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1535 ptl.x = width;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1536 GpiLine(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1537 ptl.x = width;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1538 ptl.y = height;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1539 GpiMove(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1540 ptl.x = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1541 ptl.y = height;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1542 GpiLine(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1543 ptl.x = width;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1544 ptl.y = height;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1545 GpiMove(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1546 ptl.y = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1547 ptl.x = width;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1548 GpiLine(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1549 WinReleasePS(hpsTemp);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1550 }
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1551 return res;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1552 }
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1553
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1554 /* Function to handle tooltip messages from a variety of procedures */
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1555 MRESULT EXPENTRY _TooltipProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, WindowData *blah)
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1556 {
1395
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1557 static HWND hstart, hend;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1558
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1559 switch(msg)
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1560 {
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1561 case 0x041f:
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1562 /* Mouse has left the area.. remove tooltip and stop timer */
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1563 if(hwndBubble)
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1564 {
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1565 WinDestroyWindow(hwndBubble);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1566 hwndBubble = 0;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1567 }
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1568 if(hstart)
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1569 WinStopTimer(dwhab, hstart, 1);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1570 if(hend)
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1571 WinStopTimer(dwhab, hend, 2);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1572 hstart = hend = 0;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1573 break;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1574
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1575 case 0x041e:
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1576 /* Mouse has entered... stop any pending timer...
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1577 * then start a new timer to creat the tooltip delayed.
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1578 */
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1579 if(hstart)
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1580 WinStopTimer(dwhab, hstart, 1);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1581 /* Two seconds to create */
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1582 WinStartTimer(dwhab, hwnd, 1, 2000);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1583 hstart = hwnd;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1584 break;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1585 case WM_TIMER:
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1586 if((int)mp1 == 1 || (int)mp1 == 2)
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1587 {
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1588 if(hwndBubble)
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1589 {
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1590 WinDestroyWindow(hwndBubble);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1591 hwndBubble = 0;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1592 }
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1593 /* Either starting or ending... remove tooltip and timers */
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1594 if(hstart)
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1595 WinStopTimer(dwhab, hstart, 1);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1596 if(hend)
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1597 WinStopTimer(dwhab, hend, 2);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1598 hstart = hend = 0;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1599 /* If we are starting... create a new tooltip */
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1600 if((int)mp1 == 1)
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1601 {
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1602 HPS hpsTemp = 0;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1603 LONG lHight;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1604 LONG lWidth;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1605 POINTL txtPointl[TXTBOX_COUNT];
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1606 POINTL ptlWork = {0,0};
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1607 ULONG ulColor = CLR_YELLOW;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1608 void *bubbleproc;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1609
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1610 hwndBubbleLast = hwnd;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1611 hwndBubble = WinCreateWindow(HWND_DESKTOP,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1612 WC_STATIC,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1613 NULL,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1614 SS_TEXT |
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1615 DT_CENTER |
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1616 DT_VCENTER,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1617 0,0,0,0,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1618 HWND_DESKTOP,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1619 HWND_TOP,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1620 0,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1621 NULL,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1622 NULL);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1623
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1624 WinSetPresParam(hwndBubble,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1625 PP_FONTNAMESIZE,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1626 strlen(DefaultFont)+1,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1627 DefaultFont);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1628
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1629
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1630 WinSetPresParam(hwndBubble,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1631 PP_BACKGROUNDCOLORINDEX,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1632 sizeof(ulColor),
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1633 &ulColor);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1634
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1635 WinSetWindowText(hwndBubble,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1636 (PSZ)blah->bubbletext);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1637
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1638 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1639
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1640 hpsTemp = WinGetPS(hwndBubble);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1641 GpiQueryTextBox(hpsTemp,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1642 strlen(blah->bubbletext),
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1643 (PCH)blah->bubbletext,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1644 TXTBOX_COUNT,
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1645 txtPointl);
1395
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1646 WinReleasePS(hpsTemp);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1647
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1648 lWidth = txtPointl[TXTBOX_TOPRIGHT].x -
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1649 txtPointl[TXTBOX_TOPLEFT ].x + 8;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1650
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1651 lHight = txtPointl[TXTBOX_TOPLEFT].y -
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1652 txtPointl[TXTBOX_BOTTOMLEFT].y + 8;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1653
1507
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1654 ptlWork.y -= lHight + 2;
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1655
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1656 /* Make sure it is visible on the screen */
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1657 if(ptlWork.x + lWidth > dw_screen_width())
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1658 {
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1659 ptlWork.x = dw_screen_width() - lWidth;
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1660 if(ptlWork.x < 0)
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1661 ptlWork.x = 0;
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1662 }
1395
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1663
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1664 bubbleproc = (void *)WinSubclassWindow(hwndBubble, _BubbleProc);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1665
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1666 if(bubbleproc)
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1667 WinSetWindowPtr(hwndBubble, QWP_USER, bubbleproc);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1668
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1669 WinSetWindowPos(hwndBubble,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1670 HWND_TOP,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1671 ptlWork.x,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1672 ptlWork.y,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1673 lWidth,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1674 lHight,
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1675 SWP_SIZE | SWP_MOVE | SWP_SHOW);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1676
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1677 /* Start a timer to remove it after 15 seconds */
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1678 WinStartTimer(dwhab, hwnd, 2, 15000);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1679 hend = hwnd;
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1680 }
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1681 }
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
1682 break;
1404
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
1683 }
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
1684 return (MRESULT)FALSE;
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1685 }
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1686
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1687 #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
1688 #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
1689
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1690 /* 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
1691 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
1692 {
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1693 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
1694 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
1695 /* 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
1696 * 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
1697 */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1698 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
1699 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
1700 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
1701 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
1702
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1703 /* 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
1704 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
1705 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
1706 /* 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
1707 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
1708 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
1709 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
1710 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1711
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1712 /* 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
1713 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
1714 {
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
1715 /* 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
1716 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
1717 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
1718 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
1719 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
1720 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
1721
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1722 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
1723 {
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1724 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
1725
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1726 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1727 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1728
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1729 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
1730 {
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
1731 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
1732 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
1733 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
1734 {
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
1735 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
1736 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
1737 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
1738 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
1739 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
1740 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
1741 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
1742
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 /* 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
1744 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
1745 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
1746 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
1747 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
1748
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 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
1750 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
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 /* 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
1753 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
1754 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
1755 {
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
1756 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
1757
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
1758 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
1759 {
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
1760 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
1761 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
1762 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
1763 }
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
1764 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
1765 {
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
1766 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
1767 }
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
1768 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
1769 /* 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
1770 * 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
1771 */
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
1772 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
1773 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
1774 {
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
1775 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
1776 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
1777 }
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
1778 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
1779 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
1780 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
1781 }
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
1782
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
1783 /* 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
1784 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
1785 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
1786 {
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
1787 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
1788
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
1789 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
1790 {
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
1791 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
1792 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
1793 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
1794 }
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
1795 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
1796 {
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
1797 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
1798 }
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 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
1800 /* 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
1801 * 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
1802 */
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
1803 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
1804 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
1805 {
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
1806 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
1807 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
1808 }
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
1809 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
1810 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
1811 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
1812 }
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
1813
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
1814 /* 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
1815 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
1816 {
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
1817 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
1818 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
1819 {
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
1820 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
1821 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
1822 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
1823 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
1824 }
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 }
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
1826 }
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
1827 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
1828 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
1829 {
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1830 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
1831 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
1832 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
1833 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
1834 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
1835 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
1836 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
1837 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
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 /* 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
1840 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
1841 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
1842
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1843 /* 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
1844 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
1845
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1846 /* 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
1847 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
1848 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
1849 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
1850 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
1851
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1852 /* 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
1853 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
1854 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
1855 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
1856 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
1857
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1858 /* 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
1859 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
1860 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
1861 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
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
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1864 /* 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
1865 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
1866 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
1867 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
1868 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
1869 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
1870 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
1871 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
1872 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
1873 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
1874 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
1875 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
1876
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1877 /* 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
1878 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
1879 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
1880 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
1881 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
1882 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
1883 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
1884 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
1885 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
1886 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
1887 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
1888
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1889 /* 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
1890 _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
1891 _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
1892 /* 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
1893 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
1894 _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
1895 _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
1896
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1897 /* 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
1898 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
1899 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
1900 {
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1901 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
1902
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1903 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
1904
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1905 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
1906 {
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1907 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
1908 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
1909 }
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1910 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
1911 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1912
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1913 /* 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
1914 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
1915 {
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1916 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
1917 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
1918
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1919 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
1920 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
1921 {
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
1922 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
1923 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
1924 }
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1925 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
1926 {
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
1927 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
1928 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
1929 }
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1930 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
1931 {
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
1932 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
1933 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
1934 }
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1935 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
1936 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1937
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1938 /* 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
1939 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
1940 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
1941 _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
1942 _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
1943 /* 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
1944 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
1945 _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
1946 _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
1947
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1948 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
1949
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1950 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
1951 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1952 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1953 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
1954 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
1955 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1956
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1957 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
1958 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1959
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1960
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1961 /* This procedure handles drawing of a status border */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1962 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
1963 {
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1964 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1965 PFNWP oldproc = 0;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1966
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1967 if(msg == WM_MOUSEMOVE && _wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1968 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1969
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1970 if(blah)
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1971 {
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1972 oldproc = blah->oldproc;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1973
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1974 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1975 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1976
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1977 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1978 _TooltipProc(hWnd, msg, mp1, mp2, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1979
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1980 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1981 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1982 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1983 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1984 HPS hpsPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1985 RECTL rclPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1986 char buf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1987
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1988 hpsPaint = WinBeginPaint(hWnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1989 WinQueryWindowRect(hWnd, &rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1990 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1991
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1992 GpiSetColor(hpsPaint, CLR_DARKGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1993 _Top(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1994 _Left(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1995
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1996 GpiSetColor(hpsPaint, CLR_WHITE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1997 _Right(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1998 _Bottom(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1999
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2000 WinQueryWindowText(hWnd, 1024, (PSZ)buf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2001 rclPaint.xLeft += 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2002 rclPaint.xRight--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2003 rclPaint.yTop--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2004 rclPaint.yBottom++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2005
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2006 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
2007 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
2008 WinEndPaint(hpsPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2009
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2010 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2011 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2012 }
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2013 if(oldproc)
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2014 return oldproc(hWnd, msg, mp1, mp2);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2015 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2016
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2017 return WinDefWindowProc(hWnd, msg, mp1, mp2);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2018 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2019
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
2020 /* 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
2021 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
2022 {
1520
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2023 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2024
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2025 if(blah && blah->bubbletext[0])
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2026 _TooltipProc(hWnd, msg, mp1, mp2, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2027
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2028 if(msg == WM_MOUSEMOVE &&_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2029 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2030
1520
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2031 if(blah && blah->oldproc)
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2032 {
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2033 PFNWP myfunc = blah->oldproc;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2034
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2035 return myfunc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2036 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2037
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2038 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
2039 }
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
2040
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
2041 /* This procedure handles scrollbox */
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
2042 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
2043 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2044 switch(msg)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2045 {
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
2046 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
2047 {
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
2048 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
2049 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
2050
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
2051 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
2052 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
2053 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
2054 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
2055
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
2056 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
2057 }
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2058 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
2059 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
2060 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2061 MPARAM res;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2062 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
2063 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
2064 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
2065 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
2066 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
2067 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
2068 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
2069 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
2070 RECTL rect;
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2071
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2072 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
2073
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2074 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
2075 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2076 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
2077 handle = vscroll;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2078 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
2079 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2080 else
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2081 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2082 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
2083 handle = hscroll;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2084 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
2085 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2086
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2087 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
2088 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
2089 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
2090
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2091 switch(which)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2092 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2093 case SB_SLIDERTRACK:
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2094 *pos = SHORT1FROMMP(mp2);
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2095 break;
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2096 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
2097 (*pos)--;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2098 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
2099 *pos = min;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2100 break;
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2101 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
2102 (*pos)++;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2103 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
2104 *pos = max;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2105 break;
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2106 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
2107 (*pos) -= page;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2108 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
2109 *pos = min;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2110 break;
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2111 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
2112 (*pos) += page;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2113 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
2114 *pos = max;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2115 break;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2116 }
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2117 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
2118 /* Position the scrolled box */
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2119 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
2120 break;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2121 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2122 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2123 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
2124 }
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
2125
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2126 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
2127 {
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
2128 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2129
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2130 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
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 /* These are the window classes which can
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2133 * obtain input focus.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2134 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2135 if(strncmp(tmpbuf, "#3", 3)==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 /* Generate click on default item */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2138 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2139
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2140 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2141 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2142 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2143 if(tmp->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2144 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2145 int (API_FUNC clickfunc)(HWND, void *) = (int (API_FUNC)(HWND, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2146
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2147 /* 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
2148 if(tmp->window == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2149 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2150 clickfunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2151 tmp = NULL;
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 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2155 tmp= tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2156 }
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2159 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
2160 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2161
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
2162 #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
2163 #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
2164 #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
2165 #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
2166 #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
2167
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2168 /* Originally just intended for entryfields, it now serves as a generic
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2169 * procedure for handling TAB presses to change input focus on controls.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2170 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2171 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2172 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2173 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2174 PFNWP oldproc = 0;
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
2175 char tmpbuf[100] = {0};
643
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 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2178 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2179
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2180 WinQueryClassName(hWnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2181
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2182 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2183 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2184
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2185 /* 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
2186 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2187 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2188 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2189 strncmp(tmpbuf, "#32", 4)==0) /* Spinbutton */
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 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2192 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2193 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2194 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2195 HMENUI hwndMenu = dw_menu_new(0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2196 long x, y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2197
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2198 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
2199 {
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
2200 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
2201 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
2202 }
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
2203 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
2204 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
2205 {
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
2206 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
2207 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
2208 }
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
2209 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
2210 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
2211
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2212 WinSetFocus(HWND_DESKTOP, hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2213 dw_pointer_query_pos(&x, &y);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2214 dw_menu_popup(&hwndMenu, hWnd, x, y);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2215 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2216 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2217 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2218 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2219 ULONG command = COMMANDMSG(&msg)->cmd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2220
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2221 /* MLE */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2222 if(strncmp(tmpbuf, "#10", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2223 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2224 switch(command)
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 case ENTRY_CUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2227 return WinSendMsg(hWnd, MLM_CUT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2228 case ENTRY_COPY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2229 return WinSendMsg(hWnd, MLM_COPY, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2230 case ENTRY_PASTE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2231 return WinSendMsg(hWnd, MLM_PASTE, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2232 case ENTRY_UNDO:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2233 return WinSendMsg(hWnd, MLM_UNDO, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2234 case ENTRY_SALL:
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 ULONG len = (ULONG)WinSendMsg(hWnd, MLM_QUERYTEXTLENGTH, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2237 return WinSendMsg(hWnd, MLM_SETSEL, 0, (MPARAM)len);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2238 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2239 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2240 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2241 else /* Other */
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 HWND handle = hWnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2244
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2245 /* Get the entryfield handle from multi window controls */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2246 if(strncmp(tmpbuf, "#2", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2247 handle = WinWindowFromID(hWnd, 667);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2248
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2249 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2250 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2251 switch(command)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2252 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2253 case ENTRY_CUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2254 return WinSendMsg(handle, EM_CUT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2255 case ENTRY_COPY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2256 return WinSendMsg(handle, EM_COPY, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2257 case ENTRY_PASTE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2258 return WinSendMsg(handle, EM_PASTE, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2259 case ENTRY_SALL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2260 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2261 LONG len = WinQueryWindowTextLength(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2262 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
2263 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2264 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2265 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2266 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2267 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2268 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2269 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2270 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2271
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2272 switch(msg)
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 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2275 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2276 case WM_BUTTON3DOWN:
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 if(strncmp(tmpbuf, "#32", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2279 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2280 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2281 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2282 case WM_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2283 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2284 if(strncmp(tmpbuf, "#38", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2285 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2286 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2287 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2288 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2289 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2290 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2291 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2292 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2293 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2294 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2295 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2296 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2297 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2298 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2299 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2300 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2301 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2302 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2303 _click_default(blah->clickdefault);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2304 /* 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
2305 * window hangs for reasons unknown. (in an MLE)
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 else if(SHORT1FROMMP(mp2) == 283)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2308 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2309
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2310 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2311 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2312 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2313 /* 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
2314 if(strncmp(tmpbuf, "#38", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2315 WinPostMsg(hWnd, WM_USER+7, 0, 0);
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 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2318 case WM_USER+7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2319 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2320 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
2321 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
2322 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2323 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2324 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2325 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2326 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2327 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2328 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2329
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2330 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2331 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2332
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2333 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
2334 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2335
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2336 /* 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
2337 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
2338 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2339 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2340
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2341 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2342 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2343
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2344 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2345 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2346 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2347 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2348 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2349 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2350 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2351 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2352 return _entryproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2353 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2354 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2355 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2356 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2357 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2358 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2359 /* 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
2360 if(SHORT1FROMMP(mp2) == 283)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2361 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2362 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2363 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2364
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2365 if(blah && blah->oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2366 return blah->oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2367
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2368 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
2369 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2370
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2371 /* 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
2372 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
2373 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2374 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2375 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2376 case WM_VSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2377 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2378 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2379 USHORT pos = SHORT1FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2380
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2381 WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2382 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2383 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2384 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2385 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
2386 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2387
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2388 /* Handle special messages for the spinbutton's entryfield */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2389 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2390 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2391 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2392 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2393
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2394 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2395 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2396
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2397 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2398 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2399
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2400 switch(msg)
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 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2403 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2404 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2405 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2406 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2407 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2408 return _entryproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2409 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2410
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2411 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2412 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2413
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2414 return WinDefWindowProc(hWnd, msg, mp1, mp2);
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2415 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2416
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2417 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
2418 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2419 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
2420 int range = _dw_percent_get_range(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2421 float fpos = (float)pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2422 float frange = (float)range;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2423 float fnew = (fpos/1000.0)*frange;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2424 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
2425 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2426
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2427 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
2428 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2429 int inew, range = _dw_percent_get_range(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2430 if(range)
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 float fpos = (float)pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2433 float frange = (float)range;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2434 float fnew = (fpos/frange)*1000.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2435 inew = (int)fnew;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2436 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
2437 }
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2438 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2439
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2440 /* 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
2441 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
2442 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2443 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2444 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2445
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2446 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2447 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2448
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2449 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2450 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2451
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2452 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2453 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2454 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2455 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2456 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2457 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2458 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2459 WinPostMsg(hWnd, WM_USER+7, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2460 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2461 case WM_USER+7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2462 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
2463 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2464 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2465
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2466 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2467 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2468
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2469 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2470 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2471
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2472 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2473 * flag enabled, and also handle TABs to switch input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2474 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2475 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2476 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2477 WindowData *blah = WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2478 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2479
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2480 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2481 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2482
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2483 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2484 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2485
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2486 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2487 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2488 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2489 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2490 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2491 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2492 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2493 if(SHORT1FROMMP(mp2) == '\t')
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 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2496 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2497 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2498 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2499 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2500 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2501 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2502 _click_default(blah->clickdefault);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2503 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2504 case WM_BUTTON1DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2505 case WM_BUTTON2DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2506 case WM_BUTTON3DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2507 if(dw_window_get_data(hWnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2508 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2509 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2510 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2511 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2512 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2513 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2514 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2515 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2516 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2517 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2518 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2519 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2520 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2521 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2522 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
2523 HPS hpsPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2524 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2525 unsigned long width, height, thumbheight = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2526 ULONG color;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2527
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2528 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
2529 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
2530
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2531 if(!thumbheight)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2532 thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2533
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2534 /* 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
2535 thumbheight += 6;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2536
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2537 color = (ULONG)dw_window_get_data(parent, "_dw_fore");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2538 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
2539
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2540 if(height > thumbheight)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2541 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2542 hpsPaint = WinGetPS(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2543 if(color)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2544 GpiSetColor(hpsPaint, _internal_color(color-1));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2545 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2546 GpiSetColor(hpsPaint, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2547
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2548 ptl.x = ptl.y = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2549 GpiMove(hpsPaint, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2550
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2551 ptl.x = width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2552 ptl.y = height - thumbheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2553 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2554
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2555 WinReleasePS(hpsPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2556 }
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 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2559 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2560 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2561 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2562
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2563 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2564 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2565
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2566 void _GetPPFont(HWND hwnd, char *buff)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2567 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2568 ULONG AttrFound;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2569 BYTE AttrValue[128];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2570 ULONG cbRetLen;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2571
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2572 cbRetLen = WinQueryPresParam(hwnd,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2573 PP_FONTNAMESIZE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2574 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2575 &AttrFound,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2576 sizeof(AttrValue),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2577 &AttrValue,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2578 QPF_NOINHERIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2579
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2580 if(PP_FONTNAMESIZE == AttrFound && cbRetLen)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2581 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2582 memcpy(buff, AttrValue, cbRetLen);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2583 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2584 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2585
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
2586 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
2587 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2588 MPARAM res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2589 int min, max, page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2590
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2591 if(which == SB_SLIDERTRACK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2592 return pos;
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 pos = dw_scrollbar_get_pos(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2595 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0);
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 min = SHORT1FROMMP(res);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2598 max = SHORT2FROMMP(res);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2599 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
2600
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2601 switch(which)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2602 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2603 case SB_LINEUP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2604 pos = pos - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2605 if(pos < min)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2606 pos = min;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2607 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2608 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2609 case SB_LINEDOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2610 pos = pos + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2611 if(pos > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2612 pos = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2613 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2614 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2615 case SB_PAGEUP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2616 pos = pos - page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2617 if(pos < min)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2618 pos = min;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2619 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2620 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2621 case SB_PAGEDOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2622 pos = pos + page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2623 if(pos > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2624 pos = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2625 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2626 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2627 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2628 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
2629 }
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
2630
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2631 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
2632 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2633 if(hwndEmph && WinIsWindow(dwhab, hwndEmph) && pCoreEmph)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2634 WinSendMsg(hwndEmph, CM_SETRECORDEMPHASIS, pCoreEmph, MPFROM2SHORT(FALSE, CRA_SOURCE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2635 hwndEmph = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2636 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
2637 }
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2638
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
2639 /* 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
2640 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
2641 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2642 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
2643 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
2644
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2645 /* Find the toplevel window */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2646 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
2647 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2648 menubar = (int)dw_window_get_data(lastowner, "_dw_menubar");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2649 lastowner = menuowner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2650 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2651 if(menuowner && menubar)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2652 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2653 HWND client = WinWindowFromID(menuowner, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2654
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2655 return client ? client : menuowner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2656 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2657 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
2658 }
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
2659
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2660 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2661 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2662 int result = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2663 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2664 ULONG origmsg = msg;
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 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2667 msg = WM_BUTTON1DOWN;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2668 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2669 msg = WM_BUTTON1UP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2670 if(msg == WM_VSCROLL || msg == WM_HSCROLL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2671 msg = WM_CONTROL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2672
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2673 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2674 while(tmp)
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(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
2677 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2678 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2679 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2680 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2681 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2682 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
2683 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2684 int (API_FUNC setfocusfunc)(HWND, void *) = (int (API_FUNC)(HWND, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2685
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2686 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
2687 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2688 result = setfocusfunc(tmp->window, tmp->data);
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2693 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2694 case WM_TIMER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2695 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2696 int (API_FUNC timerfunc)(void *) = (int (API_FUNC)(void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2697 if(tmp->id == (int)mp1)
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 if(!timerfunc(tmp->data))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2700 dw_timer_disconnect(tmp->id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2701 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2702 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2703 result = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2704 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2705 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2706 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2707 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2708 int (API_FUNC sizefunc)(HWND, int, int, void *) = (int (API_FUNC)(HWND, int, int, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2709
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2710 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
2711 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2712 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
2713 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2714 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2715 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2716 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2717 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2718 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2719 POINTS pts = (*((POINTS*)&mp1));
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2720 int (API_FUNC buttonfunc)(HWND, int, int, int, void *) = (int (API_FUNC)(HWND, int, int, int, void *))tmp->signalfunction;
643
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 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
2723 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2724 int button = 0;
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 switch(origmsg)
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 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2729 button = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2730 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2731 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2732 button = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2733 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2734 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2735 button = 3;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2738
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
2739 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
2740 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2741 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2742 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2743 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2744 case WM_BUTTON1UP:
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 POINTS pts = (*((POINTS*)&mp1));
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2747 int (API_FUNC buttonfunc)(HWND, int, int, int, void *) = (int (API_FUNC)(HWND, int, int, int, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2748
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2749 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
2750 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2751 int button = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2752
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2753 switch(origmsg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2754 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2755 case WM_BUTTON1UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2756 button = 1;
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_BUTTON2UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2759 button = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2760 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2761 case WM_BUTTON3UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2762 button = 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2763 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2766 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
2767 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2768 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2769 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2770 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2771 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2772 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2773 int (API_FUNC motionfunc)(HWND, int, int, int, void *) = (int (API_FUNC)(HWND, int, int, int, void *))tmp->signalfunction;
643
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 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
2776 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2777 int keys = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2778 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2779
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2780 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2781 keys = DW_BUTTON1_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2782 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2783 keys |= DW_BUTTON2_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2784 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2785 keys |= DW_BUTTON3_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2786
956
a3e4cebf3c99 Fixed incorrectly using _get_frame_height() instead of _get_height() which resulted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 906
diff changeset
2787 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
2788 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2789 }
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 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2792 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2793 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2794 int (API_FUNC keypressfunc)(HWND, char, int, int, void *) = (int (API_FUNC)(HWND, char, int, int, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2795
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2796 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
2797 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2798 int vk;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2799 char ch = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2800
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2801 if(SHORT1FROMMP(mp1) & KC_CHAR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2802 ch = (char)SHORT1FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2803 if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2804 vk = SHORT2FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2805 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2806 vk = SHORT1FROMMP(mp2) + 128;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2807
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2808 /* This is a hack to fix shift presses showing
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2809 * up as tabs!
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2810 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2811 if(ch == '\t' && !(SHORT1FROMMP(mp1) & KC_CHAR))
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 ch = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2814 vk = VK_SHIFT;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2817 result = keypressfunc(tmp->window, ch, vk,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2818 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
2819 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2820 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2821 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2822 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2823 case WM_CLOSE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2824 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2825 int (API_FUNC closefunc)(HWND, void *) = (int (API_FUNC)(HWND, void *))tmp->signalfunction;
643
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 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
2828 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2829 result = closefunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2830 if(result)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2831 result = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2832 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2835 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2836 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2837 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2838 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2839 DWExpose exp;
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2840 int (API_FUNC exposefunc)(HWND, DWExpose *, void *) = (int (API_FUNC)(HWND, DWExpose *, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2841 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2842
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2843 if(hWnd == tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2844 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2845 int height = _get_height(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2846
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2847 hps = WinBeginPaint(hWnd, 0L, &rc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2848 exp.x = rc.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2849 exp.y = height - rc.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2850 exp.width = rc.xRight - rc. xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2851 exp.height = rc.yTop - rc.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2852 result = exposefunc(hWnd, &exp, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2853 WinEndPaint(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2854 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2855 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2856 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2857 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2858 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2859 int (API_FUNC clickfunc)(HWND, void *) = (int (API_FUNC)(HWND, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2860 ULONG command = COMMANDMSG(&msg)->cmd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2861
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2862 if(tmp->id && command == tmp->id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2863 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2864 HWND menuowner = _menu_owner(tmp->window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2865
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2866 if(menuowner == hWnd || menuowner == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2867 {
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
2868 result = clickfunc((HWND)tmp->id, tmp->data);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2869 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2870 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2871 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2872 else if(tmp->window < 65536 && command == tmp->window)
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 result = clickfunc(popup ? popup : tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2875 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2878 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2879 case WM_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2880 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
2881 (tmp->message == SLN_SLIDERTRACK && SHORT2FROMMP(mp1) == SLN_CHANGE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2882 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2883 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
2884 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
2885 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
2886
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2887 if(origmsg == WM_CONTROL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2888 svar = SHORT2FROMMP(mp1);
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 switch(svar)
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 case CN_ENTER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2893 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2894 int (API_FUNC containerselectfunc)(HWND, char *, void *) = (int (API_FUNC)(HWND, char *, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2895 char *text = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2896
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2897 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2898 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2899 PRECORDCORE pre;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2900
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2901 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2902 if(pre)
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2903 text = (char *)pre->pszIcon;
643
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
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2906 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2907 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2908 result = containerselectfunc(tmp->window, text, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2909 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2910 }
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 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2913 case CN_EXPANDTREE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2914 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2915 int (API_FUNC treeexpandfunc)(HWND, HTREEITEM, void *) = (int (API_FUNC)(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
2916
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2917 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2918 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2919 result = treeexpandfunc(tmp->window, (HTREEITEM)mp2, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2920 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2921 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2922 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2923 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2924 case CN_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2925 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2926 int (API_FUNC containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (API_FUNC)(HWND, char *, int, int, void *, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2927 char *text = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2928 void *user = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2929 LONG x,y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2930
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2931 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2932 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2933 PCNRITEM pci;
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 pci = (PCNRITEM)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2936
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2937 text = (char *)pci->rc.pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2938 user = pci->user;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2939 }
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 dw_pointer_query_pos(&x, &y);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2942
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2943 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2944 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2945 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
2946
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2947 if(mp2)
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 if(!container)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2950 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2951 NOTIFYRECORDEMPHASIS pre;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2952
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2953 dw_tree_item_select(tmp->window, (HTREEITEM)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2954 pre.pRecord = mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2955 pre.fEmphasisMask = CRA_CURSORED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2956 pre.hwndCnr = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2957 _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
2958 pre.pRecord->flRecordAttr |= CRA_CURSORED;
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 else
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 if(pCoreEmph)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2963 _clear_emphasis();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2964 hwndEmph = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2965 pCoreEmph = mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2966 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
2967 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2968 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2969 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
2970 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2971 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2972 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2973 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2974 case CN_EMPHASIS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2975 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2976 PNOTIFYRECORDEMPHASIS pre = (PNOTIFYRECORDEMPHASIS)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2977 static int emph_recurse = 0;
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 if(!emph_recurse)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2980 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2981 emph_recurse = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2982
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2983 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2984 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2985 if(tmp->window == pre->hwndCnr)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2986 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2987 PCNRITEM pci = (PCNRITEM)pre->pRecord;
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 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
2990 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
2991 int (API_FUNC treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (API_FUNC)(HWND, HTREEITEM, char *, void *, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2992
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2993 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
2994 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
2995 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2996 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2997 if(lasthcnr == tmp->window && lastitem == (HWND)pci)
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 lasthcnr = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3000 lastitem = 0;
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 lasthcnr = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3005 lastitem = (HWND)pci;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
3006 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
3007 }
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 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3012 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3013 emph_recurse = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3014 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3015 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3016 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3017 case LN_SELECT:
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 char classbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3020
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
3021 WinQueryClassName(tmp->window, 99, (PCH)classbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3022
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3023 if(strncmp(classbuf, "#38", 4) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3024 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
3025 int (API_FUNC valuechangedfunc)(HWND, int, void *) = (int (API_FUNC)(HWND, int, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3026
1197
cad6f7aa421c Fixed a couple slight issues with the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1196
diff changeset
3027 if(tmp->window == hWnd || tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3028 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3029 static int lastvalue = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3030 static HWND lasthwnd = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3031 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
3032 if(lastvalue != ulValue || lasthwnd != tmp->window)
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 result = valuechangedfunc(tmp->window, ulValue, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3035 lastvalue = ulValue;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3036 lasthwnd = tmp->window;
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 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3039 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3040 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3041 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3042 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
3043 int (API_FUNC listboxselectfunc)(HWND, int, void *) = (int (API_FUNC)(HWND, int, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3044 static int _recursing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3045
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
3046 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
3047 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3048 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
3049 int index = dw_listbox_selected(tmp->window);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3050
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3051 dw_listbox_get_text(tmp->window, index, buf1, 500);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3052
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3053 _recursing = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3054
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3055 if(id && strncmp(classbuf, "#2", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3056 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3057 char *buf2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3058
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3059 buf2 = dw_window_get_text(tmp->window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3060
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3061 /* 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
3062 * 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
3063 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3064 if(buf2 && *buf2 && *buf1 && strncmp(buf1, buf2, 500) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3065 result = listboxselectfunc(tmp->window, index, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3066
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3067 if(buf2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3068 free(buf2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3069 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3070 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3071 result = listboxselectfunc(tmp->window, index, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3072
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3073 _recursing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3074 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3075 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3076 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3077 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3078 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3079 case SLN_SLIDERTRACK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3080 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
3081 int (API_FUNC valuechangedfunc)(HWND, int, void *) = (int (API_FUNC)(HWND, int, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3082
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3083 if(origmsg == WM_CONTROL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3084 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3085 /* 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
3086 if(tmp->window == hWnd || tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3087 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3088 static int lastvalue = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3089 static HWND lasthwnd = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3090 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
3091 if(lastvalue != ulValue || lasthwnd != tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3092 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3093 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
3094 result = valuechangedfunc(tmp->window, ulValue, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3095 lastvalue = ulValue;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3096 lasthwnd = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3097 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3098 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3101 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3102 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3103 /* 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
3104 if(tmp->window > 65535 && tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3105 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3106 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
3107
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3108 if(pos > -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3109 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3110 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
3111 result = valuechangedfunc(tmp->window, pos, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3112 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3113 result = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3114 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3115 }
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3118 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3119 case BKN_PAGESELECTED:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3120 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3121 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3122
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3123 if(psn && tmp->window == psn->hwndBook)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3124 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
3125 int (API_FUNC switchpagefunc)(HWND, unsigned long, void *) = (int (API_FUNC)(HWND, unsigned long, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3126
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3127 result = switchpagefunc(tmp->window, psn->ulPageIdNew, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3128 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3129 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3130 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3131 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3132 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3133 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3134 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3135 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3136 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3137
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3138 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3139 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3140
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3141 }
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
3142 if(result != -1)
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
3143 {
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
3144 /* Make sure any queued redraws are handled */
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
3145 _dw_redraw(0, FALSE);
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
3146 /* Then finally return */
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
3147 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3148 return (MRESULT)result;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3149 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3150
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
3151 /* 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
3152 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
3153 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3154 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
3155 long red, green, blue;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3156
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3157 red = dw_spinbutton_get_pos(button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3158 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
3159 green = dw_spinbutton_get_pos(button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3160 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
3161 blue = dw_spinbutton_get_pos(button);
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 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
3164 }
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
3165
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
3166 /* 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
3167 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
3168 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3169 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
3170 dw_window_set_data(window, "_dw_updating", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3171 dw_spinbutton_set_pos(button, DW_RED_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3172 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
3173 dw_spinbutton_set_pos(button, DW_GREEN_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3174 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
3175 dw_spinbutton_set_pos(button, DW_BLUE_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3176 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
3177 }
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
3178
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
3179 /* 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
3180 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
3181 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3182 WinSendMsg(col, 0x0602, MPFROMLONG(_os2_color(value)), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3183 if(!IS_WARP4())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3184 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
3185 }
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
3186
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3187 /* Handles control messages sent to the box (owner). */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3188 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3189 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3190 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER);
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 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3193 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3194 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3195 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3196 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3197 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3198 case WM_VSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3199 case WM_HSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3200 if(_run_event(hWnd, msg, mp1, mp2))
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 HWND window = WinWindowFromID(hWnd, (ULONG)mp1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3203 _HandleScroller(window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3204 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3205 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3206 /* Handles Color Selection control messages */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3207 case 0x0601:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3208 case 0x130C:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3209 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3210 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
3211 unsigned long val = (unsigned long)mp1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3212
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3213 if(window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3214 _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
3215 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3216 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3217 case WM_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3218 if((SHORT2FROMMP(mp1) == SPBN_CHANGE || SHORT2FROMMP(mp1) == SPBN_ENDSPIN))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3219 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3220 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
3221
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3222 if(window && !dw_window_get_data(window, "_dw_updating"))
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 unsigned long val = _dw_color_spin_get(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3225 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
3226
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3227 _dw_col_set(col, val);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3228 }
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 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3231 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3232 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3233
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3234 if(blah && blah->oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3235 return blah->oldproc(hWnd, msg, mp1, mp2);
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 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3238 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3239
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3240 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3241 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3242 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3243 int result = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3244 static int command_active = 0;
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
3245 void (API_FUNC windowfunc)(PVOID) = 0L;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3246
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3247 if(!command_active)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3248 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3249 /* 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
3250 command_active = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3251
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
3252 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
3253 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
3254 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
3255 result = (int)_run_event(hWnd, msg, mp1, mp2);
643
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 command_active = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3258 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3259
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3260 /* Now that any handlers are done... do normal processing */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3261 switch( msg )
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3262 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3263 case WM_ERASEBACKGROUND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3264 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3265
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3266 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3267 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3268 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3269 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3270
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3271 hps = WinBeginPaint( hWnd, 0L, &rc );
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3272 WinEndPaint( hps );
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3273 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3274 }
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 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3277 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3278 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3279
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3280 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3281 return (MPARAM)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3282
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3283 if(mybox && mybox->flags != DW_MINIMIZED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3284 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3285 /* Hide the window when recalculating to reduce
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3286 * CPU load.
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 WinShowWindow(hWnd, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3289
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
3290 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
3291 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
3292
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3293 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3294
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3295 WinShowWindow(hWnd, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3296 }
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 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3299 case WM_MINMAXFRAME:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3300 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3301 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3302 SWP *swp = (SWP *)mp1;
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 if(mybox && (swp->fl & SWP_MINIMIZE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3305 mybox->flags = DW_MINIMIZED;
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 if(mybox && (swp->fl & SWP_RESTORE))
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 if(!mybox->titlebar && mybox->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3310 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3311 mybox->flags = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3312 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3313
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3314 if(mybox && (swp->fl & (SWP_MAXIMIZE | SWP_RESTORE)))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3315 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3316 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3317 SWP swp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3318
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3319 WinQueryWindowPos(swp->hwnd, &swp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3320
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3321 if(swp2.cx == swp->cx && swp2.cy == swp->cy)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3322 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3323
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3324 mybox->flags = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3325
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3326 /* Hide the window when recalculating to reduce
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3327 * CPU load.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3328 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3329 WinShowWindow(hWnd, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3330
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3331 _do_resize(mybox, swp->cx, swp->cy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3332
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3333 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3334 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3335 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3336
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3337 for(z=0;z<mybox->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3338 _check_resize_notebook(mybox->items[z].hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3339
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 WinShowWindow(hWnd, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3343 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3344 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3345 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3346 case WM_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3347 switch(SHORT2FROMMP(mp1))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3348 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3349 case BKN_PAGESELECTEDPENDING:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3350 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3351 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3352 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
3353 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
3354 long x, y;
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
3355 unsigned long width, height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3356 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3357
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3358 if(pagebox && psn->ulPageIdNew != psn->ulPageIdCur)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3359 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3360 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
3361
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3362 rc.xLeft = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3363 rc.yBottom = y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3364 rc.xRight = x + width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3365 rc.yTop = y + height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3366
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3367 WinSendMsg(psn->hwndBook, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3368
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3369 _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
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 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3373 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3374 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3375 case WM_CLOSE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3376 if(result == -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3377 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3378 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3379 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3380 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3381 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3382 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3383 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3384 HPOINTER pointer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3385
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3386 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
3387 (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
3388 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3389 WinSetPointer(HWND_DESKTOP, pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3390 return MRFROMSHORT(TRUE);
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3393 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3394 case WM_USER:
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
3395 windowfunc = (void (API_FUNC)(void *))mp1;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3396
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3397 if(windowfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3398 windowfunc((void *)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3399 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3400 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3401 if(SHORT1FROMMP(mp2) == '\t')
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 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3404 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3405 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3406 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3407 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3408 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3409 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3410 case WM_DESTROY:
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 HWND parent = WinQueryWindow(hWnd, QW_PARENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3413
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3414 /* Free memory before destroying */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3415 if(parent && WinWindowFromID(parent, FID_CLIENT) == hWnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3416 _free_window_memory(parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3417 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3418 _free_window_memory(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3419 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3420 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3421 case WM_MENUEND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3422 /* Delay removing the signal until we've executed
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3423 * the signal handler.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3424 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3425 WinPostMsg(hWnd, WM_USER+2, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3426 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
3427 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
3428 /* 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
3429 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
3430 break;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3431 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
3432 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
3433 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
3434 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
3435 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
3436 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
3437 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
3438 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
3439 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3440 case WM_USER+2:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3441 _clear_emphasis();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3442 if(dw_window_get_data((HWND)mp2, "_dw_popup"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3443 _free_menu_data((HWND)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3444 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3447 if(result != -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3448 return (MRESULT)result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3449 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3450 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3451 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3452
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3453 void _changebox(Box *thisbox, int percent, int type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3454 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3455 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3456
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3457 for(z=0;z<thisbox->count;z++)
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 if(thisbox->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3460 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3461 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3462 _changebox(tmp, percent, type);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3463 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3464 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3465 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3466 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3467 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3468 if(thisbox->items[z].hsize == SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3469 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
3470 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3471 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3472 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3473 if(thisbox->items[z].vsize == SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3474 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
3475 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3476 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3477 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3478 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3479
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3480 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
3481 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3482 float ratio = (float)percent/(float)100.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3483 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
3484 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
3485 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3486
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3487 WinShowWindow(handle1, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3488 WinShowWindow(handle2, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3489
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3490 if(type == DW_HORZ)
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 int newx = (int)((float)x * ratio) - (SPLITBAR_WIDTH/2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3493
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3494 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
3495 _do_resize(tmp, newx - 1, y - 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3496
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3497 dw_window_set_data(hwnd, "_dw_start", (void *)newx);
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 tmp = WinQueryWindowPtr(handle2, QWP_USER);
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 newx = x - newx - SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3502
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3503 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
3504 _do_resize(tmp, newx - 1, y - 1);
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3507 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3508 int newy = (int)((float)y * ratio) - (SPLITBAR_WIDTH/2);
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 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
3511 _do_resize(tmp, x - 1, newy - 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3512
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3513 tmp = WinQueryWindowPtr(handle2, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3514
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3515 newy = y - newy - SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3516
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3517 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
3518 _do_resize(tmp, x - 1, newy - 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3519
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3520 dw_window_set_data(hwnd, "_dw_start", (void *)newy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3521 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3522
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3523 WinShowWindow(handle1, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3524 WinShowWindow(handle2, TRUE);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3525 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3526
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3527
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3528 /* This handles any activity on the splitbars (sizers) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3529 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3530 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3531 switch (msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3532 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3533 case WM_ACTIVATE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3534 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3535 return (MRESULT)(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3536
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3537 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3538 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3539 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3540 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3541 RECTL rcl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3542 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
3543 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
3544
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3545 hps = WinBeginPaint(hwnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3546
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3547 WinQueryWindowRect(hwnd, &rcl);
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(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3550 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3551 ptl[0].x = rcl.xLeft + start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3552 ptl[0].y = rcl.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3553 ptl[1].x = rcl.xRight + start + 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3554 ptl[1].y = rcl.yTop;
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3557 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3558 ptl[0].x = rcl.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3559 ptl[0].y = rcl.yBottom + start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3560 ptl[1].x = rcl.xRight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3561 ptl[1].y = rcl.yTop + start + 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3562 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3563
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 GpiSetColor(hps, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3566 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3567 GpiBox(hps, DRO_OUTLINEFILL, &ptl[1], 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3568 WinEndPaint(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3569 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3570 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3571
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3572 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3573 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3574 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
3575
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3576 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3577 WinSetPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3578 WinQuerySysPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3579 SPTR_SIZEWE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3580 FALSE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3581 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3582 WinSetPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3583 WinQuerySysPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3584 SPTR_SIZENS,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3585 FALSE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3586 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3587 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3588 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3589 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3590 APIRET rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3591 RECTL rclFrame;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3592 RECTL rclBounds;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3593 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
3594 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
3595 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
3596
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3597 WinQueryWindowRect(hwnd, &rclFrame);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3598 WinQueryWindowRect(hwnd, &rclBounds);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3599
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3600 WinMapWindowPoints(hwnd, HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3601 (PPOINTL)&rclBounds, 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3602
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 if(type == DW_HORZ)
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 rclFrame.xLeft = start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3607 rclFrame.xRight = start + SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3608 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3609 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3610 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3611 rclFrame.yBottom = start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3612 rclFrame.yTop = start + SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3613 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3614
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3615 if(percent)
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 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3618
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3619 if(rc == TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3620 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3621 int width = (rclBounds.xRight - rclBounds.xLeft);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3622 int height = (rclBounds.yTop - rclBounds.yBottom);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3623
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3624 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3625 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3626 start = rclFrame.xLeft - rclBounds.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3627 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3628 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3629 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3630 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3631 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3632 start = rclFrame.yBottom - rclBounds.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3633 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3634 *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
3635 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3636 _handle_splitbar_resize(hwnd, *percent, type, width, height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3637 _handle_splitbar_resize(hwnd, *percent, type, width, height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3638 }
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3641 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3642 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3643 return WinDefWindowProc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3644 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3645
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
3646 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
3647 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3648 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
3649 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
3650 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
3651 MRESULT res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3652 unsigned long width, height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3653 int x = 5, y = 5;
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 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
3656
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3657 if(!oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3658 res = WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3659 res = oldproc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3660
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3661 if(icon)
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 ULONG halftone = DP_NORMAL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3664 HPS hps = WinGetPS(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3665 POINTERINFO pi;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3666 int cx, cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3667
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3668 if(dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3669 halftone = DP_HALFTONED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3670
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3671 cx = width - 10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3672 cy = height - 10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3673
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3674 if(WinQueryPointerInfo(icon, &pi))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3675 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3676 BITMAPINFOHEADER sl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3677 int newcx = cx, newcy = cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3678
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3679 /* Check the mini icon first */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3680 if(GpiQueryBitmapParameters(pi.hbmMiniColor, &sl))
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 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
3683 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3684 newcx = sl.cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3685 newcy = sl.cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3686 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3687 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3688 /* Check the normal icon second */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3689 if(GpiQueryBitmapParameters(pi.hbmColor, &sl))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3690 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3691 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
3692 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3693 newcx = sl.cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3694 newcy = sl.cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3695 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3696 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3697 cx = newcx; cy = newcy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3698 x = (width - cx)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3699 y = (height - cy)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3700 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3701 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
3702 WinReleasePS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3703 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3704 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3705 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3706 x = (width - pixmap->width)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3707 y = (height - pixmap->height)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3708
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3709 if(disable && dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3710 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
3711 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3712 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
3713 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3714 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
3715 }
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3716
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3717 /* Function: BtProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3718 * Abstract: Subclass procedure for buttons
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3719 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3720
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3721 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3722 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3723 WindowData *blah = WinQueryWindowPtr(hwnd, QWL_USER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3724 PFNWP oldproc;
1434
2cca36ec3da6 Fixed automatic redrawing not occurring on OS/2 and Windows when changes were made from a button press handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1433
diff changeset
3725 int retval = -1;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3726
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3727 if(!blah)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3728 return WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3729
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3730 oldproc = blah->oldproc;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3731
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3732 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3733 _TooltipProc(hwnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3734
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3735 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3736 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3737 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3738 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3739 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3740 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3741 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3742 return _button_draw(hwnd, msg, mp1, mp2, oldproc, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3743 case BM_SETHILITE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3744 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
3745 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3746 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3747 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3748 else
1337
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3749 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
3750 /* 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
3751 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
3752 {
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3753 RECTL rcl;
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3754
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3755 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
3756
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3757 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
3758 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
3759 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3760 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3761 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3762 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3763 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3764 case WM_BUTTON1DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3765 case WM_BUTTON2DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3766 case WM_BUTTON3DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3767 if(dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3768 return (MRESULT)FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3769 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3770 case WM_BUTTON1UP:
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 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3773
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3774 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
3775 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3776 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3777 while(tmp)
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->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3780 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3781 /* 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
3782 if(tmp->window == hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3783 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3784 /* 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
3785 * here, finishing actions on the button will occur
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3786 * 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
3787 * 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
3788 * do before we run our handler.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3789 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3790 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3791 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3792 }
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 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3795 tmp= tmp->next;
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 }
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 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3800 case WM_USER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3801 {
1434
2cca36ec3da6 Fixed automatic redrawing not occurring on OS/2 and Windows when changes were made from a button press handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1433
diff changeset
3802 SignalHandler *tmp = (SignalHandler *)mp1;
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
3803 int (API_FUNC clickfunc)(HWND, void *) = NULL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3804
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3805 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3806 {
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
3807 clickfunc = (int (API_FUNC)(HWND, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3808
1434
2cca36ec3da6 Fixed automatic redrawing not occurring on OS/2 and Windows when changes were made from a button press handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1433
diff changeset
3809 retval = clickfunc(tmp->window, tmp->data);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3810 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3811 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3812 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3813 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3814 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3815 /* 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
3816 * while the button has the active input focus.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3817 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3818 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3819 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3820 SignalHandler *tmp = Root;
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 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3823 while(tmp)
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 if(tmp->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3826 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3827 /* 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
3828 if(tmp->window == hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3829 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3830 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3831 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3834 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3835 tmp= tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3836 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3837 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3838 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3839 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3840 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3841 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3842 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3843 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3844 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3845 return FALSE;
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 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
3848 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3849 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3850 return FALSE;
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 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
3853 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3854 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3855 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3856 }
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 break;
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3859 }
1434
2cca36ec3da6 Fixed automatic redrawing not occurring on OS/2 and Windows when changes were made from a button press handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1433
diff changeset
3860
2cca36ec3da6 Fixed automatic redrawing not occurring on OS/2 and Windows when changes were made from a button press handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1433
diff changeset
3861 /* Make sure windows are up-to-date */
2cca36ec3da6 Fixed automatic redrawing not occurring on OS/2 and Windows when changes were made from a button press handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1433
diff changeset
3862 if(retval != -1)
2cca36ec3da6 Fixed automatic redrawing not occurring on OS/2 and Windows when changes were made from a button press handler.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1433
diff changeset
3863 _dw_redraw(0, FALSE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3864 if(!oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3865 return WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3866 return oldproc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3867 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3868
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3869 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3870 {
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3871 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3872 int res = (int)_run_event(hwnd, msg, mp1, mp2);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3873
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3874 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3875 _TooltipProc(hwnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3876
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3877 switch(msg)
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 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3880 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3881 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3882 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3883 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3884 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3885 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3886 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
3887 WinSetFocus(HWND_DESKTOP, hwnd);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3888 else if(res)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3889 return (MPARAM)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3890 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3891 return WinDefWindowProc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3892 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3893
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3894 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
3895 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3896 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3897 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3898
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3899 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3900 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3901
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3902 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3903 _TooltipProc(hwnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3904
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3905 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3906 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3907 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3908 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3909 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3910 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3911 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3912 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3913 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3914 RECTL rcl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3915 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3916
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3917 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3918 oldproc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3919
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3920 hps = WinBeginPaint(hwnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3921 WinQueryWindowRect(hwnd, &rcl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3922 ptl[0].x = rcl.xLeft + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3923 ptl[0].y = rcl.yBottom + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3924 ptl[1].x = rcl.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3925 ptl[1].y = rcl.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3926
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3927 GpiSetColor(hps, CLR_BLACK);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3928 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3929 GpiBox(hps, DRO_OUTLINE, &ptl[1], 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3930 WinEndPaint(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3931 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3932 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3933 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3934 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3935 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3936 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3937 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3938 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3939 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3940 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3941 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3942 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3943 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3944 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3945 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3946 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3947
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3948 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3949
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3950 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3951 return oldproc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3952
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3953 return WinDefWindowProc(hwnd, msg, mp1, mp2);
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3954 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3955
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3956 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3957 * Initializes the Dynamic Windows engine.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3958 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3959 * newthread: True if this is the only thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3960 * False if there is already a message loop running.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3961 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3962 int API dw_init(int newthread, int argc, char *argv[])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3963 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3964 APIRET rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3965 char objnamebuf[300] = "";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3966
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3967 /* 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
3968 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
3969 {
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3970 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
3971
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3972 /* 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
3973 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
3974 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
3975
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3976 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
3977 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
3978 }
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3979 /* 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
3980 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
3981 _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
3982
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3983 if(newthread)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3984 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3985 dwhab = WinInitialize(0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3986 dwhmq = WinCreateMsgQueue(dwhab, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3987 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3988
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
3989 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
3990 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
3991 rc = WinRegisterClass(dwhab, (PSZ)ScrollClassName, _scrollwndproc, 0L, 32);
1534
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
3992 rc = WinRegisterClass(dwhab, (PSZ)CalendarClassName, _calendarproc, 0L, 32);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3993
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3994 /* Get the OS/2 version. */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3995 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
3996
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3997 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3998
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3999 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
4000 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
4001 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
4002 DefaultFont = strdup(DefaultFont);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4003
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4004 /* 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
4005 * application does and handles menu messages.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4006 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4007 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
4008 /* 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
4009 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
4010
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4011 /* 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
4012 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
4013 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
4014 DosQueryProcAddr(pmprintf, 0, (PSZ)"PmPrintfString", (PFN*)&_PmPrintfString);
1495
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
4015 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMMERGE", &pmmerge))
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
4016 DosQueryProcAddr(pmmerge, 5469, NULL, (PFN*)&_WinQueryDesktopWorkArea);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4017 return rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4018 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4019
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4020 static int _dw_main_running = FALSE;
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4021
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4022 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4023 * 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
4024 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4025 void API dw_main(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4026 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4027 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4028
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4029 _dwtid = dw_thread_id();
1449
632346743f46 Fixed dw_window_redraw() on Windows not recalculating notebook page contents if the notebook size didn't change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1445
diff changeset
4030 /* Make sure any queued redraws are handled */
632346743f46 Fixed dw_window_redraw() on Windows not recalculating notebook page contents if the notebook size didn't change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1445
diff changeset
4031 _dw_redraw(0, FALSE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4032
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4033 /* Set the running flag to TRUE */
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4034 _dw_main_running = TRUE;
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4035
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4036 /* Run the loop until the flag is unset... or error */
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4037 while(_dw_main_running && WinGetMsg(dwhab, &qmsg, 0, 0, 0))
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4038 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4039 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4040 _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
4041 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4042 }
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4043 }
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4044
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4045 /*
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4046 * Causes running dw_main() to return.
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4047 */
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4048 void API dw_main_quit(void)
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4049 {
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4050 _dw_main_running = FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4051 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4052
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4053 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4054 * 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
4055 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4056 * 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
4057 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4058 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
4059 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4060 QMSG qmsg;
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4061 #ifdef __EMX__
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4062 struct timeval tv, start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4063
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4064 gettimeofday(&start, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4065 gettimeofday(&tv, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4066
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4067 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
4068 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4069 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4070 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4071 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4072 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4073 _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
4074 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4075 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4076 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4077 DosSleep(1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4078 gettimeofday(&tv, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4079 }
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
4080 #else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4081 double start = (double)clock();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4082
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4083 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4084 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4085 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4086 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4087 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4088 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4089 _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
4090 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4091 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4092 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4093 DosSleep(1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4094 }
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4095 #endif
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4096 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4097
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4098 /*
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
4099 * 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
4100 */
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
4101 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
4102 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4103 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4104
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4105 _dwtid = dw_thread_id();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4106
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4107 if(WinGetMsg(dwhab, &qmsg, 0, 0, 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4108 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4109 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4110 _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
4111 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4112 }
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
4113 }
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
4114
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
4115 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4116 * Free's memory allocated by dynamic windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4117 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4118 * ptr: Pointer to dynamic windows allocated
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4119 * memory to be free()'d.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4120 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4121 void API dw_free(void *ptr)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4122 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4123 free(ptr);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4124 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4125
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4126 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4127 * Allocates and initializes a dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4128 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4129 * data: User defined data to be passed to functions.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4130 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4131 DWDialog * API dw_dialog_new(void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4132 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4133 DWDialog *tmp = malloc(sizeof(DWDialog));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4134
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4135 tmp->eve = dw_event_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4136 dw_event_reset(tmp->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4137 tmp->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4138 tmp->done = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4139 tmp->result = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4140
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4141 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4142 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4143
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4144 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4145 * Accepts a dialog struct and returns the given data to the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4146 * initial called of dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4147 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4148 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4149 * result: Data to be returned by dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4150 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4151 int API dw_dialog_dismiss(DWDialog *dialog, void *result)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4152 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4153 dialog->result = result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4154 dw_event_post(dialog->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4155 dialog->done = TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4156 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4157 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4158
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4159 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4160 * Accepts a dialog struct waits for dw_dialog_dismiss() to be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4161 * called by a signal handler with the given dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4162 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4163 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4164 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4165 void * API dw_dialog_wait(DWDialog *dialog)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4166 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4167 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4168 void *tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4169
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4170 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4171 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4172 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4173 _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
4174 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4175 if(dialog->done)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4176 break;
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 dw_event_close(&dialog->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4179 tmp = dialog->result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4180 free(dialog);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4181 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4182 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4183
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
4184 /*
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
4185 * 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
4186 * 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
4187 * 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
4188 * ...: 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
4189 */
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
4190 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
4191 {
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 va_list args;
1404
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4193 char outbuf[1025] = { 0 };
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
4194
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 va_start(args, format);
1404
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4196 #if defined(__IBMC__)
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
4197 vsprintf(outbuf, format, args);
1404
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4198 #else
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4199 vsnprintf(outbuf, 1024, format, args);
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4200 #endif
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
4201 va_end(args);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4202
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4203 if(_PmPrintfString)
1395
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
4204 {
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
4205 int len = strlen(outbuf);
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
4206
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
4207 /* Trim off trailing newline for PMPrintf */
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
4208 if(len > 0 && outbuf[len-1] == '\n')
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
4209 outbuf[len-1] = 0;
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 _PmPrintfString(outbuf);
1395
e0a66f06501c Updated the tooltip bubble help on OS/2 to display the tooltip after 2 seconds...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1394
diff changeset
4211 }
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4212 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
4213 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
4214 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4215
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4216 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4217 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4218 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4219 * 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
4220 * flags: flags to indicate buttons and icon
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4221 * format: printf style format string.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4222 * ...: Additional variables for use in the format.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4223 */
399
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
4224 int API dw_messagebox(char *title, int flags, char *format, ...)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4225 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4226 va_list args;
1404
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4227 char outbuf[1025] = { 0 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4228 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4229
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4230 va_start(args, format);
1404
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4231 #if defined(__IBMC__)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4232 vsprintf(outbuf, format, args);
1404
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4233 #else
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4234 vsnprintf(outbuf, 1024, format, args);
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4235 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4236 va_end(args);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4237
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4238 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
4239 if(rc == MBID_OK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4240 return DW_MB_RETURN_OK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4241 else if(rc == MBID_YES)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4242 return DW_MB_RETURN_YES;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4243 else if(rc == MBID_NO)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4244 return DW_MB_RETURN_NO;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4245 else if(rc == MBID_CANCEL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4246 return DW_MB_RETURN_CANCEL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4247 else return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4248 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4249
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4250 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4251 * Makes the window topmost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4252 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4253 * 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
4254 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4255 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
4256 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4257 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
4258 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4259
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4260 /*
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4261 * Makes the window bottommost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4262 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4263 * 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
4264 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4265 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
4266 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4267 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
4268 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4269
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4270 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4271 * Makes the window visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4272 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4273 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4274 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4275 int API dw_window_show(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4276 {
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
4277 int rc = WinShowWindow(handle, TRUE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4278 HSWITCH hswitch;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4279 SWCNTRL swcntrl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4280
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4281 _fix_button_owner(_toplevel_window(handle), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4282 WinSetFocus(HWND_DESKTOP, handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4283 _initial_focus(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4284
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4285 /* 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
4286 hswitch = WinQuerySwitchHandle(handle, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4287 if(hswitch)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4288 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4289 WinQuerySwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4290 swcntrl.uchVisibility = SWL_VISIBLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4291 WinChangeSwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4292 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4293 if(WinWindowFromID(handle, FID_CLIENT))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4294 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4295 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4296
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4297 if(blah && !(blah->flags & DW_OS2_NEW_WINDOW))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4298 {
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4299 /* Handle auto-positioning and auto-sizing */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4300 ULONG cx = dw_screen_width(), cy = dw_screen_height();
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4301 HWND parent = WinQueryWindow(handle, QW_PARENT);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4302 int newx, newy, changed = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4303 SWP swp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4304
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4305 /* If it is an MDI window...
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4306 * find the MDI area.
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4307 */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4308 if(parent && parent != desktop)
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4309 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4310 WinQueryWindowPos(parent, &swp);
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4311 cx = swp.cx;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4312 cy = swp.cy;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4313 /* If the MDI parent isn't visible...
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4314 * we can't calculate. Drop out.
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4315 */
1495
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
4316 if(cx < 1 || cy < 1)
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4317 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4318 WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_MOVE);
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4319 return rc;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4320 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4321 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4322
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4323 blah->flags |= DW_OS2_NEW_WINDOW;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4324
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4325 WinQueryWindowPos(handle, &swp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4326
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4327 /* If the size is 0 then auto-size */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4328 if(swp.cx == 0 || swp.cy == 0)
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4329 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4330 dw_window_set_size(handle, 0, 0);
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4331 WinQueryWindowPos(handle, &swp);
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4332 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4333
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4334 /* If the position was not set... generate a default
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4335 * default one in a similar pattern to SHELLPOSITION.
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4336 */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4337 if(swp.x == -2000 || swp.y == -2000)
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4338 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4339 static int defaultx = 0, defaulty = 0;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4340 int maxx = cx / 4, maxy = cy / 4;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4341
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4342 defaultx += 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4343 defaulty += 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4344
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4345 if(defaultx > maxx)
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4346 defaultx = 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4347 if(defaulty > maxy)
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4348 defaulty = 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4349
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4350 newx = defaultx;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4351 /* Account for flipped Y */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4352 newy = cy - defaulty - swp.cy;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4353 changed = 1;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4354 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4355 else
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4356 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4357 newx = swp.x;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4358 newy = swp.y;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4359 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4360
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4361 /* Make sure windows shown for the first time are
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4362 * completely visible if possible.
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4363 */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4364 if(swp.cx < cx && (newx+swp.cx) > cx)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4365 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4366 newx = (cx - swp.cx)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4367 changed = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4368 }
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4369 if(swp.cy < cy && (newy+swp.cy) > cy)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4370 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4371 newy = (cy - swp.cy)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4372 changed = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4373 }
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4374
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4375 if(changed)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4376 WinSetWindowPos(handle, NULLHANDLE, newx, newy, 0, 0, SWP_MOVE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4377 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4378 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4379 return rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4380 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4381
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4382 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4383 * 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
4384 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4385 * handle: The window handle to minimize.
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4386 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4387 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
4388 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4389 HWND hwndclient = WinWindowFromID(handle, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4390
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4391 if(hwndclient)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4392 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4393 Box *box = (Box *)WinQueryWindowPtr(hwndclient, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4394
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4395 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4396 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4397 if(!box->titlebar && box->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4398 WinSetParent(box->hwndtitle, handle, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4399 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4400 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4401
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4402 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
4403 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4404
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4405 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4406 * Makes the window invisible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4407 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4408 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4409 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4410 int API dw_window_hide(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4411 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4412 HSWITCH hswitch;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4413 SWCNTRL swcntrl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4414
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4415 /* 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
4416 hswitch = WinQuerySwitchHandle(handle, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4417 if(hswitch)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4418 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4419 WinQuerySwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4420 swcntrl.uchVisibility = SWL_INVISIBLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4421 WinChangeSwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4422 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4423 return WinShowWindow(handle, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4424 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4425
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4426 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4427 * Destroys a window and all of it's children.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4428 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4429 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4430 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4431 int API dw_window_destroy(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4432 {
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4433 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
4434 Box *thisbox;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4435
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4436 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
4437 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
4438
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4439 /* 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
4440 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
4441 {
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4442 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
4443
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4444 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
4445 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
4446
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4447 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
4448 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
4449 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
4450 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4451
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4452 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
4453 thisbox = WinQueryWindowPtr(parent, QWP_USER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4454 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
4455
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4456 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4457 _free_menu_data(menu);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4458
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
4459 /* 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
4460 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
4461 {
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
4462 /* 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
4463 * 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
4464 */
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
4465 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
4466 {
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
4467 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
4468 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
4469
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
4470 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
4471 {
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
4472 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
4473 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
4474 }
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
4475
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
4476 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
4477 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
4478
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
4479 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
4480
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
4481 /* 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
4482 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
4483 {
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
4484 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
4485 }
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
4486 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
4487 {
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
4488 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
4489 }
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
4490
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
4491 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
4492 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
4493 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
4494 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4495 _free_window_memory(frame ? frame : handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4496 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4497 return WinDestroyWindow(frame ? frame : handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4498 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4499
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
4500 /* 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
4501 * 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
4502 * 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
4503 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4504 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
4505 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4506 HWND client = WinWindowFromID(handle, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4507 HWND window = client ? client : handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4508 Box *mybox = (Box *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4509
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4510 _fix_button_owner(_toplevel_window(handle), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4511 if(window && mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4512 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4513 unsigned long width, height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4514
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4515 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
4516
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
4517 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
4518 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
4519
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
4520 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
4521 _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
4522 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
4523 }
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
4524 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4525
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4526 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4527 * Changes a window's parent to newparent.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4528 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4529 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4530 * newparent: The window's new parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4531 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4532 void API dw_window_reparent(HWND handle, HWND newparent)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4533 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4534 HWND blah = WinWindowFromID(newparent, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4535 WinSetParent(handle, blah ? blah : newparent, TRUE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4536 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4537
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4538 /* 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
4539 * Parameters:
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4540 * currfont: current font
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4541 * Returns:
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4542 * 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
4543 */
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4544 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
4545 {
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
4546 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
4547 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
4548 int size = 9;
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4549
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4550 /* 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
4551 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
4552 {
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
4553 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
4554 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
4555 {
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
4556 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
4557 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
4558 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
4559 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
4560 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
4561 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
4562 }
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
4563 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
4564 {
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
4565 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
4566 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
4567 }
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
4568 }
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4569
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4570 /* 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
4571 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
4572 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
4573 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
4574 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
4575 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
4576 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
4577 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
4578 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
4579 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
4580
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4581 /* 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
4582 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
4583 {
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
4584 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
4585 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
4586 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
4587 }
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
4588 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
4589 /* 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
4590 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
4591 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
4592 return buf;
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4593 }
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4594
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4595 /*
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
4596 * 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
4597 * 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
4598 * 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
4599 */
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
4600 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
4601 {
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
4602 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
4603
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
4604 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
4605 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
4606 }
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
4607
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4608 /* Internal function to return a pointer to an item struct
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4609 * with information about the packing information regarding object.
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4610 */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4611 Item *_box_item(HWND handle)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4612 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4613 HWND parent = WinQueryWindow(handle, QW_PARENT);
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4614 Box *thisbox = (Box *)WinQueryWindowPtr(parent, QWP_USER);
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4615
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4616 /* If it is a desktop window let WM_DESTROY handle it */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4617 if(parent != HWND_DESKTOP)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4618 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4619 if(thisbox && thisbox->count)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4620 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4621 int z;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4622 Item *thisitem = thisbox->items;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4623
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4624 for(z=0;z<thisbox->count;z++)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4625 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4626 if(thisitem[z].hwnd == handle)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4627 return &thisitem[z];
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4628 }
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4629 }
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4630 }
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4631 return NULL;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4632 }
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4633
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4634 /* Internal function to calculate the widget's required size..
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4635 * These are the general rules for widget sizes:
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4636 *
1537
a4ecef1980db Added code for returning a size for scrolled widgets on OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1534
diff changeset
4637 * Render/Unspecified: 1x1
a4ecef1980db Added code for returning a size for scrolled widgets on OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1534
diff changeset
4638 * Scrolled(Container,Tree,MLE): 500x200
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4639 * Entryfield/Combobox/Spinbutton: 150x(maxfontheight)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4640 * Spinbutton: 50x(maxfontheight)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4641 * Text/Status: (textwidth)x(textheight)
1537
a4ecef1980db Added code for returning a size for scrolled widgets on OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1534
diff changeset
4642 * Ranged: 100x14 or 14x100 for vertical.
a4ecef1980db Added code for returning a size for scrolled widgets on OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1534
diff changeset
4643 * Buttons/Bitmaps: Size of text or image and border.
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4644 */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4645 void _control_size(HWND handle, int *width, int *height)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4646 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4647 int thiswidth = 1, thisheight = 1, extrawidth = 0, extraheight = 0;
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
4648 char tmpbuf[100] = {0}, *buf = dw_window_get_text(handle);
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4649 static char testtext[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4650
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4651 WinQueryClassName(handle, 99, (PCH)tmpbuf);
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4652
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4653 /* If we have a string...
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4654 * calculate the size with the current font.
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4655 */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4656 if(buf)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4657 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4658 if(*buf)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4659 dw_font_text_extents_get(handle, NULL, buf, &thiswidth, &thisheight);
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4660 dw_free(buf);
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4661 }
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4662
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4663 /* Combobox */
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4664 if(strncmp(tmpbuf, "#2", 3)==0)
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4665 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4666 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight);
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4667 thiswidth = 150;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4668 extraheight = 4;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4669 if(thisheight < 18)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4670 thisheight = 18;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4671 }
1534
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4672 /* Calendar */
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4673 else if(strncmp(tmpbuf, CalendarClassName, strlen(CalendarClassName)+1)==0)
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4674 {
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4675 thiswidth = 200;
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4676 thisheight = 150;
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4677 }
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4678 /* Bitmap/Static */
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4679 else if(strncmp(tmpbuf, "#5", 3)==0)
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4680 {
1424
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4681 HBITMAP hbm = (HBITMAP)WinSendMsg(handle, SM_QUERYHANDLE, MPVOID, MPVOID);
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4682
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4683 if(hbm)
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4684 {
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4685 BITMAPINFOHEADER2 bmp;
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4686 bmp.cbFix = sizeof(BITMAPINFOHEADER2);
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4687 /* Get the parameters of the bitmap */
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4688 if(GpiQueryBitmapInfoHeader(hbm, &bmp))
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4689 {
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4690 thiswidth = bmp.cx;
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4691 thisheight = bmp.cy;
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4692 }
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4693 }
1433
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4694 else if(dw_window_get_data(handle, "_dw_status"))
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4695 {
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4696 extrawidth = 4;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4697 extraheight = 4;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4698 }
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4699 }
1458
23f7fcc1c727 Split out scrollbars from the rest of the ranged widgets on OS/2... the others require extra size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1455
diff changeset
4700 /* Ranged: Slider/Percent */
23f7fcc1c727 Split out scrollbars from the rest of the ranged widgets on OS/2... the others require extra size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1455
diff changeset
4701 else if(strncmp(tmpbuf, "#38", 4)== 0)
23f7fcc1c727 Split out scrollbars from the rest of the ranged widgets on OS/2... the others require extra size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1455
diff changeset
4702 {
23f7fcc1c727 Split out scrollbars from the rest of the ranged widgets on OS/2... the others require extra size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1455
diff changeset
4703 thiswidth = 100;
23f7fcc1c727 Split out scrollbars from the rest of the ranged widgets on OS/2... the others require extra size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1455
diff changeset
4704 thisheight = 20;
23f7fcc1c727 Split out scrollbars from the rest of the ranged widgets on OS/2... the others require extra size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1455
diff changeset
4705 }
23f7fcc1c727 Split out scrollbars from the rest of the ranged widgets on OS/2... the others require extra size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1455
diff changeset
4706 /* Scrollbar */
23f7fcc1c727 Split out scrollbars from the rest of the ranged widgets on OS/2... the others require extra size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1455
diff changeset
4707 else if(strncmp(tmpbuf, "#8", 3)== 0)
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4708 {
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4709 /* Check for vertical scrollbar */
1458
23f7fcc1c727 Split out scrollbars from the rest of the ranged widgets on OS/2... the others require extra size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1455
diff changeset
4710 if(WinQueryWindowULong(handle, QWL_STYLE) & SBS_VERT)
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4711 {
1445
8f7692fcad37 Use system metrics/values to get the scrollbar sizes on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1444
diff changeset
4712 thiswidth = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL);
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4713 thisheight = 100;
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4714 }
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4715 else
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4716 {
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4717 thiswidth = 100;
1445
8f7692fcad37 Use system metrics/values to get the scrollbar sizes on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1444
diff changeset
4718 thisheight = WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL);
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4719 }
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4720 }
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4721 /* Spinbutton */
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4722 else if(strncmp(tmpbuf, "#32", 4)==0)
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4723 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4724 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight);
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4725 thiswidth = 50;
1459
98de42fc664d Add missing extra height from spinbuttons OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1458
diff changeset
4726 extraheight = 6;
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4727 }
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4728 /* Entryfield */
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4729 else if(strncmp(tmpbuf, "#6", 3)==0)
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4730 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4731 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight);
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4732 thiswidth = 150;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4733 extraheight = 6;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4734 }
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4735 /* MLE */
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4736 else if(strncmp(tmpbuf, "#10", 4)==0)
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4737 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4738 unsigned long bytes;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4739 int height, width;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4740 char *buf, *ptr;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4741 int basicwidth;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4742 int wrap = WinSendMsg(handle, MLM_QUERYWRAP, 0,0);
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4743
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4744 thisheight = 8;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4745 basicwidth = thiswidth = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL) + 8;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4746
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4747 dw_mle_get_size(handle, &bytes, NULL);
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4748
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4749 ptr = buf = _alloca(bytes + 2);
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4750 dw_mle_export(handle, buf, 0, (int)bytes);
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4751 buf[bytes] = 0;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4752 strcat(buf, "\n");
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4753
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4754 /* MLE */
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4755 while(ptr = strstr(buf, "\n"))
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4756 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4757 ptr[0] = 0;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4758 width = 0;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4759 if(strlen(buf))
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4760 dw_font_text_extents_get(handle, NULL, buf, &width, &height);
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4761 else
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4762 dw_font_text_extents_get(handle, NULL, testtext, NULL, &height);
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4763
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4764 width += basicwidth;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4765
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4766 if(wrap && width > _DW_SCROLLED_MAX_WIDTH)
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4767 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4768 thiswidth = _DW_SCROLLED_MAX_WIDTH;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4769 thisheight += height * (width / _DW_SCROLLED_MAX_WIDTH);
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4770
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4771 }
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4772 else
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4773 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4774 if(width > thiswidth)
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4775 thiswidth = width > _DW_SCROLLED_MAX_WIDTH ? _DW_SCROLLED_MAX_WIDTH : width;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4776 }
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4777 thisheight += height;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4778 buf = &ptr[1];
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4779 }
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4780
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4781 if(thiswidth < _DW_SCROLLED_MIN_WIDTH)
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4782 thiswidth = _DW_SCROLLED_MIN_WIDTH;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4783 if(thisheight < _DW_SCROLLED_MIN_HEIGHT)
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4784 thisheight = _DW_SCROLLED_MIN_HEIGHT;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4785 if(thisheight > _DW_SCROLLED_MAX_HEIGHT)
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4786 thisheight = _DW_SCROLLED_MAX_HEIGHT;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4787 }
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4788 /* Container and Tree */
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4789 else if(strncmp(tmpbuf, "#37", 4)==0)
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4790 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4791 thiswidth = _DW_SCROLLED_MAX_WIDTH;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4792 thisheight = _DW_SCROLLED_MAX_HEIGHT;
1537
a4ecef1980db Added code for returning a size for scrolled widgets on OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1534
diff changeset
4793 }
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4794 /* Button */
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4795 else if(strncmp(tmpbuf, "#3", 3)==0)
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4796 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4797 ULONG style = WinQueryWindowULong(handle, QWL_STYLE);
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4798
1433
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4799 if(style & BS_AUTOCHECKBOX || style & BS_AUTORADIOBUTTON)
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4800 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4801 extrawidth = 24;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4802 extraheight = 4;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4803 }
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4804 else
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4805 {
1433
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4806 /* Handle bitmap buttons */
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4807 if(dw_window_get_data(handle, "_dw_bitmapbutton"))
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4808 {
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4809 WNDPARAMS wp;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4810 BTNCDATA bcd;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4811
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4812 wp.fsStatus = WPM_CTLDATA;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4813 wp.cbCtlData = sizeof(BTNCDATA);
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4814 wp.pCtlData = &bcd;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4815
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4816 /* Query the button's bitmap */
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4817 if(WinSendMsg(handle, WM_QUERYWINDOWPARAMS, (MPARAM)&wp, MPVOID) && bcd.hImage)
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4818 {
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4819 BITMAPINFOHEADER2 bmp;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4820 bmp.cbFix = sizeof(BITMAPINFOHEADER2);
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4821 /* Get the parameters of the bitmap */
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4822 if(GpiQueryBitmapInfoHeader(bcd.hImage, &bmp))
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4823 {
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4824 thiswidth = bmp.cx;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4825 thisheight = bmp.cy;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4826 }
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4827 }
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4828 }
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4829 else
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4830 {
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4831 extrawidth = 4;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4832 extraheight = 4;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4833 }
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4834 if(!(style & BS_NOBORDER))
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4835 {
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4836 extrawidth += 4;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4837 extraheight += 4;
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
4838 }
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4839 }
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4840 }
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4841
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4842 /* Set the requested sizes */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4843 if(width)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4844 *width = thiswidth + extrawidth;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4845 if(height)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4846 *height = thisheight + extraheight;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4847 }
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4848
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
4849 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4850 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4851 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4852 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4853 * fontname: Name and size of the font in the form "size.fontname"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4854 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4855 int API dw_window_set_font(HWND handle, char *fontname)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4856 {
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
4857 HWND group = (HWND)dw_window_get_data(handle, "_dw_buddy");
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4858 /* If we changed the font... */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4859 if(!WinSetPresParam(group ? group : handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname))
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4860 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4861 Item *item = _box_item(handle);
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4862
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4863 /* Check to see if any of the sizes need to be recalculated */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4864 if(item && (item->origwidth == -1 || item->origheight == -1))
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4865 {
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4866 _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL);
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4867 /* Queue a redraw on the top-level window */
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4868 _dw_redraw(_toplevel_window(handle), TRUE);
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4869 }
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4870 return DW_ERROR_NONE;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4871 }
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4872 return DW_ERROR_UNKNOWN;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4873 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4874
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4875 /*
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4876 * 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
4877 * Parameters:
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4878 * 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
4879 * 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
4880 */
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4881 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
4882 {
1010
9af693aafa93 Attempt at implmenting dw_window_get_font on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1009
diff changeset
4883 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
4884 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
4885 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
4886 return strdup(str);
9af693aafa93 Attempt at implmenting dw_window_get_font on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1009
diff changeset
4887 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
4888 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4889
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4890 /* Internal function to handle transparent children */
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4891 void _handle_transparent(HWND handle)
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4892 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4893 ULONG pcolor, which = PP_BACKGROUNDCOLOR;;
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4894
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4895
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4896 if(!WinQueryPresParam(handle, which, 0, NULL, sizeof(pcolor), &pcolor, QPF_NOINHERIT))
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4897 which = PP_BACKGROUNDCOLORINDEX;
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4898
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4899 if(which == PP_BACKGROUNDCOLOR ||
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4900 WinQueryPresParam(handle, which, 0, NULL, sizeof(pcolor), &pcolor, QPF_NOINHERIT))
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4901 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4902 HWND child;
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4903 HENUM henum = WinBeginEnumWindows(handle);
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4904
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4905 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4906 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4907 if(dw_window_get_data(child, "_dw_transparent"))
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4908 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4909 WinSetPresParam(child, which, sizeof(pcolor), &pcolor);
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4910 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4911 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4912 WinEndEnumWindows(henum);
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4913 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4914 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4915
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4916 /* Internal version */
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4917 int _dw_window_set_color(HWND handle, ULONG fore, ULONG back)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4918 {
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4919 /* Handle foreground */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4920 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4921 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4922 RGB2 rgb2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4923
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4924 rgb2.bBlue = DW_BLUE_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4925 rgb2.bGreen = DW_GREEN_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4926 rgb2.bRed = DW_RED_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4927 rgb2.fcOptions = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4928
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4929 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4930
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4931 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4932 else if(fore != DW_CLR_DEFAULT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4933 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4934 fore = _internal_color(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4935
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4936 WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4937 }
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4938 /* Handle background */
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4939 if(back == DW_RGB_TRANSPARENT)
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4940 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4941 /* Special case for setting transparent */
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4942 ULONG pcolor;
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4943 HWND parent = WinQueryWindow(handle, QW_PARENT);
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4944
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4945 dw_window_set_data(handle, "_dw_transparent", DW_INT_TO_POINTER(1));
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4946
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4947 if(WinQueryPresParam(parent, PP_BACKGROUNDCOLOR, 0, NULL,
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4948 sizeof(pcolor), &pcolor, QPF_NOINHERIT | QPF_PURERGBCOLOR))
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4949 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(pcolor), &pcolor);
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4950 else if(WinQueryPresParam(parent, PP_BACKGROUNDCOLORINDEX, 0, NULL,
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4951 sizeof(pcolor), &pcolor, QPF_NOINHERIT))
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4952 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(pcolor), &pcolor);
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4953 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4954 else if((back & DW_RGB_COLOR) == DW_RGB_COLOR)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4955 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4956 RGB2 rgb2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4957
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4958 rgb2.bBlue = DW_BLUE_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4959 rgb2.bGreen = DW_GREEN_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4960 rgb2.bRed = DW_RED_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4961 rgb2.fcOptions = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4962
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4963 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4964 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4965 else if(back != DW_CLR_DEFAULT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4966 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4967 back = _internal_color(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4968
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4969 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4970 }
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4971 /* If this is a box... check if any of the children are transparent */
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4972 _handle_transparent(handle);
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
4973 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4974 }
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4975 /*
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4976 * 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
4977 * Parameters:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4978 * handle: The window (widget) handle.
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4979 * 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
4980 * 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
4981 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4982 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
4983 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4984 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
4985 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
4986
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4987 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
4988 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4989
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4990 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4991 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4992 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4993 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4994 * border: Size of the window border in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4995 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4996 int API dw_window_set_border(HWND handle, int border)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4997 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4998 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4999 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5000 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5001
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5002 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5003 * Captures the mouse input to this window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5004 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5005 * handle: Handle to receive mouse input.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5006 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5007 void API dw_window_capture(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5008 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5009 WinSetCapture(HWND_DESKTOP, handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5010 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5011
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5012 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5013 * Releases previous mouse capture.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5014 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5015 void API dw_window_release(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5016 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5017 WinSetCapture(HWND_DESKTOP, NULLHANDLE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5018 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5019
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5020 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5021 * Tracks this window movement.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5022 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5023 * handle: Handle to frame to be tracked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5024 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5025 void API dw_window_track(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5026 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5027 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5028 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5029
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5030 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5031 * 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
5032 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5033 * 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
5034 * 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
5035 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
5036 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
5037 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5038 HPOINTER pointer = pointertype < 65535 ?
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5039 WinQuerySysPointer(HWND_DESKTOP, pointertype, FALSE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5040 : (HPOINTER)pointertype;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5041
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5042 if(!pointertype)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5043 dw_window_set_data(handle, "_dw_pointer", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5044 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5045 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5046 WinSetPointer(HWND_DESKTOP, pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5047
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5048 if(handle != HWND_DESKTOP)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5049 dw_window_set_data(handle, "_dw_pointer", (void *)pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5050 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5051 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5052
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5053 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5054 * Create a new Window Frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5055 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5056 * owner: The Owner's window handle or HWND_DESKTOP.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5057 * title: The Window title.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5058 * flStyle: Style flags, see the PM reference.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5059 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5060 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5061 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5062 HWND hwndframe;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5063 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5064 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5065 ULONG winStyle = 0L;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5066
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5067 newbox->type = DW_VERT;
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
5068 newbox->vsize = newbox->hsize = SIZEEXPAND;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5069
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5070 flStyle |= FCF_NOBYTEALIGN;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5071
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5072 if(flStyle & DW_FCF_TITLEBAR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5073 newbox->titlebar = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5074 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5075 flStyle |= FCF_TITLEBAR;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5076
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5077 if(flStyle & WS_MAXIMIZED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5078 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5079 winStyle |= WS_MAXIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5080 flStyle &= ~WS_MAXIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5081 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5082 if(flStyle & WS_MINIMIZED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5083 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5084 winStyle |= WS_MINIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5085 flStyle &= ~WS_MINIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5086 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5087
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
5088 /* Then create the real window window without FCF_SHELLPOSITION */
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
5089 flStyle &= ~FCF_SHELLPOSITION;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5090 hwndframe = WinCreateStdWindow(hwndOwner, winStyle, &flStyle, (PSZ)ClassName, (PSZ)title, 0L, NULLHANDLE, 0L, &newbox->hwnd);
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
5091 /* Default the window to a ridiculus place so it can't possibly be intentional */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
5092 WinSetWindowPos(hwndframe, NULLHANDLE, -2000, -2000, 0, 0, SWP_MOVE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5093 newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5094 if(!newbox->titlebar && newbox->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5095 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5096 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5097 WinSetWindowPtr(hwndframe, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5098 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5099 return hwndframe;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5100 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5101
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5102 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5103 * Create a new Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5104 * 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
5105 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5106 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5107 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5108 HWND API dw_box_new(int type, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5109 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5110 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5111
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5112 newbox->pad = pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5113 newbox->type = type;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5114 newbox->count = 0;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
5115 newbox->grouphwnd = NULLHANDLE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5116
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5117 newbox->hwnd = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5118 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5119 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5120 WS_VISIBLE | WS_CLIPCHILDREN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5121 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5122 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5123 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5124 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5125 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5126 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5127 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5128
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5129 newbox->oldproc = WinSubclassWindow(newbox->hwnd, _controlproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5130 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5131 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
5132 return newbox->hwnd;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5133 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5134
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5135 /*
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5136 * 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
5137 * Parameters:
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5138 * 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
5139 * 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
5140 */
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5141 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
5142 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5143 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
5144 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
5145 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
5146 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
5147 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
5148 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
5149 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
5150 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
5151 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
5152 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
5153 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
5154 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
5155 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
5156 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
5157 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
5158 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
5159 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
5160 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
5161 return hwndframe;
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5162 }
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5163
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
5164 /*
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5165 * 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
5166 * 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
5167 * 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
5168 * 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
5169 */
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5170 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
5171 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5172 HWND scroll;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5173
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5174 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
5175 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5176 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
5177 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5178 else
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5179 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5180 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
5181 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5182 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
5183 }
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5184
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5185 /*
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5186 * 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
5187 * 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
5188 * 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
5189 * 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
5190 */
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5191 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
5192 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5193 HWND scroll;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5194
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5195 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
5196 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5197 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
5198 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5199 else
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5200 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5201 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
5202 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5203 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
5204 }
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5205
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5206 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5207 * Create a new Group Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5208 * 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
5209 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5210 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5211 * title: Text to be displayined in the group outline.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5212 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5213 HWND API dw_groupbox_new(int type, int pad, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5214 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5215 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5216 newbox->pad = pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5217 newbox->type = type;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5218 newbox->count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5219
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5220 newbox->hwnd = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5221 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5222 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5223 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5224 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5225 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5226 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5227 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5228 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5229 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5230 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5231
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5232 newbox->grouphwnd = WinCreateWindow(newbox->hwnd,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5233 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5234 (PSZ)title,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5235 WS_VISIBLE | SS_GROUPBOX |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5236 WS_GROUP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5237 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5238 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5239 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5240 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5241 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5242 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5243
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5244 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5245 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
5246 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
5247 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
5248 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
5249 return newbox->hwnd;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5250 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5251
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5252 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5253 * 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
5254 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5255 * 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
5256 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5257 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
5258 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5259 HWND hwndframe;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5260 ULONG back = CLR_DARKGRAY;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5261
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5262 hwndframe = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5263 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5264 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5265 WS_VISIBLE | WS_CLIPCHILDREN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5266 FS_NOBYTEALIGN,
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
5267 0,0,0,0,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5268 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5269 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5270 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5271 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5272 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5273 /* 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
5274 WinSetPresParam(hwndframe, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5275 return hwndframe;
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5276 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5277
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5278 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5279 * Create a bitmap object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5280 * 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
5281 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5282 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5283 HWND API dw_bitmap_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5284 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5285 return WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5286 WC_STATIC,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5287 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5288 WS_VISIBLE | SS_TEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5289 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5290 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5291 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5292 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5293 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5294 NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5295 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5296
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5297 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5298 * Create a notebook object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5299 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5300 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5301 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5302 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5303 HWND API dw_notebook_new(ULONG id, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5304 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5305 ULONG flags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5306 HWND tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5307
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5308 if(top)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5309 flags = BKS_MAJORTABTOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5310 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5311 flags = BKS_MAJORTABBOTTOM;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5312
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5313 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5314 WC_NOTEBOOK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5315 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5316 WS_VISIBLE |
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
5317 #ifdef BKS_TABBEDDIALOG
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5318 BKS_TABBEDDIALOG |
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
5319 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5320 flags,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5321 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5322 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5323 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5324 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5325 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5326 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5327
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5328 /* Fix tab sizes on Warp 3 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5329 if(!IS_WARP4())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5330 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5331 /* best sizes to be determined by trial and error */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5332 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
5333 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5334
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5335 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5336 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5337 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5338
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5339 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5340 * Create a menu object to be popped up.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5341 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5342 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5343 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5344 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5345 HMENUI API dw_menu_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5346 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5347 HMENUI tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5348 WC_MENU,
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 WS_VISIBLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5351 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5352 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5353 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5354 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5355 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5356 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5357 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5358 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5359
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5360 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5361 * Create a menubar on a window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5362 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5363 * location: Handle of a window frame to be attached to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5364 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5365 HMENUI API dw_menubar_new(HWND location)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5366 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5367 HMENUI tmp = WinCreateWindow(location,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5368 WC_MENU,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5369 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5370 WS_VISIBLE | MS_ACTIONBAR,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5371 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5372 location,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5373 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5374 FID_MENU,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5375 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5376 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5377 dw_window_set_data(tmp, "_dw_owner", (void *)location);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5378 dw_window_set_data(tmp, "_dw_menubar", (void *)location);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5379 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5380 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5381
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5382 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5383 * Destroys a menu created with dw_menubar_new or dw_menu_new.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5384 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5385 * menu: Handle of a menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5386 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5387 void API dw_menu_destroy(HMENUI *menu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5388 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5389 if(menu)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5390 WinDestroyWindow(*menu);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5391 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5392
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
5393 /* 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
5394 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
5395 {
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
5396 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
5397
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
5398 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
5399 {
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
5400 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
5401 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
5402 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
5403 }
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
5404 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
5405 }
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
5406
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5407 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5408 * Adds a menuitem or submenu to an existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5409 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5410 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5411 * title: The title text on the menu item to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5412 * id: An ID to be used for message passing.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5413 * flags: Extended attributes to set on the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5414 * end: If TRUE memu is positioned at the end of the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5415 * 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
5416 * flags: Extended attributes to set on the menu.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5417 * submenu: Handle to an existing menu to be a submenu or NULL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5418 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5419 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
5420 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5421 MENUITEM miSubMenu;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5422 char buffer[30];
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5423 int is_checked, is_disabled;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5424
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
5425 if ( !menux || !WinIsWindow(dwhab, menux) )
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5426 return NULLHANDLE;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5427
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5428 if ( end )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5429 miSubMenu.iPosition=MIT_END;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5430 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5431 miSubMenu.iPosition=0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5432 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5433 * Handle flags
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5434 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5435 miSubMenu.afAttribute = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5436 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
5437 if ( is_checked )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5438 miSubMenu.afAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5439 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
5440 if ( is_disabled )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5441 miSubMenu.afAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5442
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
5443 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
5444 {
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
5445 /* 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
5446 * 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
5447 */
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
5448 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
5449 {
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
5450 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
5451
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
5452 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
5453 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
5454
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
5455 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
5456 tempid = 61000;
1316
3475887f9445 Fixed tabs inserted by my editor on OS/2 again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1315
diff changeset
5457 }
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
5458 /* 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
5459 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
5460 {
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
5461 check = 0;
1316
3475887f9445 Fixed tabs inserted by my editor on OS/2 again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1315
diff changeset
5462 }
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
5463 /* 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
5464 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
5465 {
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
5466 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
5467
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
5468 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
5469 {
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
5470 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
5471 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
5472 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
5473 }
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
5474 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
5475 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
5476 }
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
5477 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
5478 }
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
5479 else
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5480 miSubMenu.afStyle = MIS_SEPARATOR;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5481 miSubMenu.id=id;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5482 miSubMenu.hwndSubMenu = submenu;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5483 miSubMenu.hItem=NULLHANDLE;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5484
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5485 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
5486
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5487 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
5488 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
5489 sprintf(buffer, "_dw_checkable%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5490 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
5491 sprintf(buffer, "_dw_ischecked%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5492 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
5493 sprintf(buffer, "_dw_isdisabled%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5494 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
5495
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5496 if ( submenu )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5497 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
5498 return (HWND)id;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5499 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5500
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5501 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5502 * 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
5503 * Deprecated; use dw_menu_item_set_state()
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5504 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5505 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5506 * id: Menuitem id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5507 * check: TRUE for checked FALSE for not checked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5508 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5509 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5510 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5511 if ( check )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5512 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
5513 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5514 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
5515 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5516
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5517 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5518 * 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
5519 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5520 * 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
5521 * id: Menuitem id.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5522 * 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
5523 * DW_MIS_CHECKED/DW_MIS_UNCHECKED
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5524 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5525 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
5526 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5527 char buffer1[30],buffer2[30];
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5528 int check;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5529 int disabled;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5530 USHORT fAttribute=0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5531
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5532 sprintf( buffer1, "_dw_ischecked%ld", id );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5533 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
5534 sprintf( buffer2, "_dw_isdisabled%ld", id );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5535 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
5536
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5537 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
5538 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5539 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5540 * 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
5541 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5542 if ( state & DW_MIS_CHECKED )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5543 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5544 fAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5545 check = 1;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5546 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5547 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5548 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5549 check = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5550 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5551 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5552 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5553 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5554 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5555 * ...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
5556 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5557 if ( check )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5558 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5559 fAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5560 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5561 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5562 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
5563 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5564 if ( state & DW_MIS_DISABLED )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5565 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5566 fAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5567 disabled = 1;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5568 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5569 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5570 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5571 disabled = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5572 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5573 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5574 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5575 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5576 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5577 * ...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
5578 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5579 if ( disabled )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5580 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5581 fAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5582 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5583 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5584 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
5585 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5586 * Keep our internal checked state consistent
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5587 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5588 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
5589 dw_window_set_data( hwndApp, buffer2, (void *)disabled );
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5590 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5591
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5592 /*
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5593 * 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
5594 * Parameters:
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5595 * 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
5596 * 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
5597 * Returns:
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5598 * 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
5599 */
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5600 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
5601 {
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
5602 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
5603 {
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5604 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
5605 /* 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
5606 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
5607 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
5608 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
5609 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5610 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
5611 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5612
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5613 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5614 * Pops up a context menu at given x and y coordinates.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5615 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5616 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5617 * parent: Handle to the window initiating the popup.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5618 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5619 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5620 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5621 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5622 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5623 if(menu)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5624 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5625 popup = parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5626 dw_window_set_data(*menu, "_dw_popup", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5627 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
5628 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5629 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5630
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5631 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5632 * Returns the current X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5633 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5634 * x: Pointer to variable to store X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5635 * y: Pointer to variable to store Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5636 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5637 void API dw_pointer_query_pos(long *x, long *y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5638 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5639 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5640
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5641 WinQueryPointerPos(HWND_DESKTOP, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5642 if(x && y)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5643 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5644 *x = ptl.x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5645 *y = dw_screen_height() - ptl.y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5646 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5647 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5648
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5649 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5650 * Sets the X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5651 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5652 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5653 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5654 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5655 void API dw_pointer_set_pos(long x, long y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5656 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5657 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5658 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5659
310
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
5660
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5661 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5662 * Create a container object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5663 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5664 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5665 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5666 */
350
2216e65ad2ae Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 347
diff changeset
5667 HWND API dw_container_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5668 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5669 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5670 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5671 WC_CONTAINER,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5672 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5673 WS_VISIBLE | CCS_READONLY |
1029
60d6d2c87116 Switched back to CCS_EXTENDSEL from CCS_MULTIPLESEL...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1024
diff changeset
5674 (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) |
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5675 CCS_AUTOPOSITION,
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
5676 0,0,0,0,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5677 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5678 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
5679 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5680 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5681 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5682 blah->oldproc = WinSubclassWindow(tmp, _TreeProc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5683 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5684 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5685 dw_window_set_data(tmp, "_dw_container", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5686 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5687 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5688
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5689 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5690 * 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
5691 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5692 * 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
5693 * 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
5694 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5695 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
5696 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5697 CNRINFO cnrinfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5698 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5699 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5700 WC_CONTAINER,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5701 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5702 WS_VISIBLE | CCS_READONLY |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5703 CCS_SINGLESEL | CCS_AUTOPOSITION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5704 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5705 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5706 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
5707 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5708 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5709 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5710
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5711 cnrinfo.flWindowAttr = CV_TREE | CA_TREELINE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5712 cnrinfo.slBitmapOrIcon.cx = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5713 cnrinfo.slBitmapOrIcon.cy = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5714 cnrinfo.cyLineSpacing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5715 cnrinfo.cxTreeIndent = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5716 cnrinfo.cxTreeLine = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5717
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5718 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
5719 CMA_LINESPACING | CMA_CXTREEINDENT | CMA_CXTREELINE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5720 blah->oldproc = WinSubclassWindow(tmp, _TreeProc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5721 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5722 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5723 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
5724 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5725
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5726 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5727 * Create a new static text window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5728 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5729 * 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
5730 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5731 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5732 HWND API dw_text_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5733 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5734 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5735 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5736 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5737 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5738 WS_VISIBLE | SS_TEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5739 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5740 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5741 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5742 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5743 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5744 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5745 blah->oldproc = WinSubclassWindow(tmp, _textproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5746 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5747 dw_window_set_font(tmp, DefaultFont);
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5748 dw_window_set_color(tmp, DW_CLR_BLACK, DW_RGB_TRANSPARENT);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5749 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5750 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5751
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5752 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5753 * 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
5754 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5755 * 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
5756 * 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
5757 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5758 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
5759 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5760 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5761 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5762 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5763 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5764 WS_VISIBLE | SS_TEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5765 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5766 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5767 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5768 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5769 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5770 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5771 blah->oldproc = WinSubclassWindow(tmp, _statusproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5772 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5773 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5774 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
1433
feb0429278e2 Improvements on OS/2 to how buttons and text/status field sizes are calculated.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1429
diff changeset
5775 dw_window_set_data(tmp, "_dw_status", DW_INT_TO_POINTER(1));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5776 return tmp;
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5777 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5778
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5779 #ifndef MLS_LIMITVSCROLL
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5780 #define MLS_LIMITVSCROLL 0x00000080L
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5781 #endif
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5782
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5783 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5784 * Create a new Multiline Editbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5785 * 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
5786 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5787 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5788 HWND API dw_mle_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5789 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5790 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5791 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5792 WC_MLE,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5793 NULL,
1544
1fd3a9635c4d Enable MLE line wrap by default on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1537
diff changeset
5794 WS_VISIBLE | MLS_WORDWRAP |
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5795 MLS_BORDER | MLS_IGNORETAB |
1544
1fd3a9635c4d Enable MLE line wrap by default on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1537
diff changeset
5796 MLS_VSCROLL | MLS_LIMITVSCROLL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5797 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5798 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5799 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5800 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5801 NULL,
996
69cf9f26e899 Removed some code I accidentally commited to the OS/2 module.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 995
diff changeset
5802 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
5803 WinSendMsg(tmp, MLM_FORMAT, (MPARAM)MLFIE_NOTRANS, 0);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5804 blah->oldproc = WinSubclassWindow(tmp, _mleproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5805 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5806 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5807 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5808 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5809
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5810 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5811 * Create a new Entryfield window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5812 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5813 * 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
5814 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5815 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5816 HWND API dw_entryfield_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5817 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
5818
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5819 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5820 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5821 WC_ENTRYFIELD,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5822 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5823 WS_VISIBLE | ES_MARGIN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5824 ES_AUTOSCROLL | WS_TABSTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5825 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5826 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5827 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5828 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5829 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5830 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5831 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5832 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5833 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5834 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
5835 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5836 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5837
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5838 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5839 * Create a new Entryfield (password) window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5840 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5841 * 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
5842 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5843 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5844 HWND API dw_entryfield_password_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5845 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5846 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5847 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5848 WC_ENTRYFIELD,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5849 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5850 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5851 ES_AUTOSCROLL | WS_TABSTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5852 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5853 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5854 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5855 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5856 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5857 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5858 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5859 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5860 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5861 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
5862 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5863 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5864
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5865 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5866 * Create a new Combobox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5867 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5868 * 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
5869 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5870 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5871 HWND API dw_combobox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5872 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5873 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5874 HWND frame = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5875 HWND tmp = WinCreateWindow(frame,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5876 WC_COMBOBOX,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5877 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5878 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5879 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5880 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5881 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
5882 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5883 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5884 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5885 HENUM henum = WinBeginEnumWindows(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5886 HWND child, last = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5887
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5888 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5889 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5890 WindowData *moreblah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5891 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5892 WinSetWindowPtr(child, QWP_USER, moreblah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5893 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
5894 last = child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5895 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5896 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5897 blah->oldproc = WinSubclassWindow(tmp, _comboproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5898 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5899 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5900 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
5901 dw_window_set_data(tmp, "_dw_comboentry", (void *)last);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5902 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
5903 WinSetOwner(tmp, frame);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5904 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5905 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5906
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5907 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5908 * Create a new button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5909 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5910 * 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
5911 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5912 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5913 HWND API dw_button_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5914 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5915 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5916 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5917 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5918 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5919 WS_VISIBLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5920 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5921 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5922 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5923 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5924 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5925 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5926
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5927 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5928
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5929 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5930 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5931 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
5932 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5933 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5934
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5935 /* Function: GenResIDStr
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5936 ** Abstract: Generate string '#nnnn' for a given ID for using with Button
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5937 ** controls
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5938 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5939
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5940 void _GenResIDStr(CHAR *buff, ULONG ulID)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5941 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5942 char *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5943 int slen = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5944
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5945 *buff++ = '#';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5946
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5947 str = buff;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5948
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5949 do
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5950 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5951 *str++ = (ulID % 10) + '0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5952 ulID /= 10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5953 slen++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5954 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5955 while(ulID);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5956
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5957 *str-- = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5958
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5959 for(; str > buff; str--, buff++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5960 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5961 *buff ^= *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5962 *str ^= *buff;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5963 *buff ^= *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5964 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5965 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5966
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5967
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5968 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5969 * Create a new bitmap button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5970 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5971 * text: Bubble help text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5972 * id: An ID of a bitmap in the resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5973 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5974 HWND API dw_bitmapbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5975 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5976 char idbuf[256], *name = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5977 HWND tmp;
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5978 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5979 HPOINTER icon = WinLoadPointer(HWND_DESKTOP, 0L, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5980
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5981 if(!icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5982 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5983 name = idbuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5984 _GenResIDStr(idbuf, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5985 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5986
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5987 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5988 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5989 (PSZ)name,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5990 WS_VISIBLE | BS_PUSHBUTTON |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5991 BS_NOPOINTERFOCUS | BS_AUTOSIZE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5992 (icon ? 0 : BS_BITMAP),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5993 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5994 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5995 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5996 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5997 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5998 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5999
1397
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6000 if(text)
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6001 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1);
1393
eb83c9830dfa Compile fixes for that last commit on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1392
diff changeset
6002 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6003
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6004 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6005
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6006 if(icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6007 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
6008 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6009 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6010 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6011
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6012 /*
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6013 * 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
6014 * Parameters:
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6015 * 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
6016 * 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
6017 * 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
6018 * 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
6019 * (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
6020 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
6021 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
6022 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6023 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
6024 HWND tmp = WinCreateWindow(HWND_OBJECT,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6025 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6026 NULL,
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6027 WS_VISIBLE | BS_PUSHBUTTON |
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6028 BS_AUTOSIZE | BS_NOPOINTERFOCUS,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6029 0,0,2000,1000,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6030 NULLHANDLE,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6031 HWND_TOP,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6032 id,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6033 NULL,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6034 NULL);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6035 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6036 HPIXMAP pixmap = NULL, disabled = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6037 HPOINTER icon = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6038
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6039 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
6040 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6041 int z, j, lim, len;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6042 LONG fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6043
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6044 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6045
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6046 /* 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
6047 if(access(file, 04) == 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6048 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6049 len = strlen( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6050 if(len > 4)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6051 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6052 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
6053 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6054 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6055 _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
6056 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6057 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6058 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6059 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6060 /* Try with .ico extension first...*/
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6061 strcat(file, ".ico");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6062 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
6063 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6064 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6065 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6066 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6067 strcat(file, ".bmp");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6068 if(access(file, 04) == 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6069 _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
6070 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6071 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6072
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6073 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6074 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6075 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6076 pixmap = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6077 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6078 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6079 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6080 /* Create a disabled style pixmap */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6081 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
6082 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
6083
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6084 fore = _foreground;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6085 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
6086 lim = pixmap->width/2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6087 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
6088 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6089 int mod = j%2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6090
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6091 for(z=0;z<lim;z++)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6092 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
6093 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6094 _foreground = fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6095 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6096 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6097
1397
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6098 if(text)
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6099 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1);
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6100 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6101
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6102 WinSetWindowPtr(tmp, QWP_USER, blah);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6103
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6104 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6105 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
6106 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6107 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6108 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
6109 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
6110 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6111 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
6112 return tmp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6113 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6114
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6115 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6116 * 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
6117 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6118 * 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
6119 * 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
6120 * data: The contents of the image
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6121 * (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
6122 * len: length of str
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6123 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6124 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
6125 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6126 FILE *fp;
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6127 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
6128 HWND tmp = WinCreateWindow(HWND_OBJECT,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6129 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6130 NULL,
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6131 WS_VISIBLE | BS_PUSHBUTTON |
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6132 BS_AUTOSIZE | BS_NOPOINTERFOCUS,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6133 0,0,2000,1000,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6134 NULLHANDLE,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6135 HWND_TOP,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6136 id,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6137 NULL,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6138 NULL);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6139 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6140 HPIXMAP pixmap = NULL, disabled = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6141 HPOINTER icon = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6142
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6143 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
6144 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6145 int z, j, lim;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6146 LONG fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6147 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6148 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6149 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6150 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6151 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6152 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6153 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6154 fclose( fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6155 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
6156 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6157 _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
6158 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6159 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
6160 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6161 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6162 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6163 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6164 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6165 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6166 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6167 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6168 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6169 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6170 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6171
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6172 if ( icon )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6173 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6174 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6175 pixmap = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6176 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6177 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6178 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6179 /* Create a disabled style pixmap */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6180 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
6181 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
6182
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6183 fore = _foreground;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6184 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
6185 lim = pixmap->width/2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6186 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
6187 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6188 int mod = j%2;
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 for(z=0;z<lim;z++)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6191 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
6192 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6193 _foreground = fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6194 }
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
1397
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6197 if(text)
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6198 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1);
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6199 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6200
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6201 WinSetWindowPtr(tmp, QWP_USER, blah);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6202
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6203 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6204 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
6205 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6206 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6207 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
6208 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
6209 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6210 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
6211 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
6212 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6213
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6214 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6215 * Create a new spinbutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6216 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6217 * 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
6218 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6219 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6220 HWND API dw_spinbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6221 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6222 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6223 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6224 WC_SPINBUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6225 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6226 WS_VISIBLE | SPBS_MASTER,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6227 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6228 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6229 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6230 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6231 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6232 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6233 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
6234 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
6235 WinSendMsg(tmp, SPBM_SETCURRENTVALUE, MPFROMLONG(atoi(text)), 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6236 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6237 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6238 blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6239 blah->oldproc = WinSubclassWindow(entry, _spinentryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6240 WinSetWindowPtr(entry, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6241 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6242 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
6243 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
6244 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6245 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6246
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6247 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6248 * Create a new radiobutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6249 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6250 * 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
6251 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6252 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6253 HWND API dw_radiobutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6254 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6255 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6256 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6257 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6258 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6259 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6260 BS_AUTORADIOBUTTON,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6261 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6262 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6263 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6264 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6265 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6266 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6267 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6268 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6269 dw_window_set_font(tmp, DefaultFont);
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
6270 dw_window_set_color(tmp, DW_CLR_BLACK, DW_RGB_TRANSPARENT);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6271 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6272 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6273
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
6274
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6275 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6276 * 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
6277 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6278 * 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
6279 * 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
6280 * 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
6281 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6282 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
6283 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6284 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6285 SLDCDATA sldcData = { 0, 0, 0, 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6286 HWND tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6287
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6288 sldcData.cbSize = sizeof(SLDCDATA);
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
6289 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
6290
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6291 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6292 WC_SLIDER,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6293 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6294 WS_VISIBLE | SLS_SNAPTOINCREMENT |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6295 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6296 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6297 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6298 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
6299 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6300 &sldcData,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6301 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6302
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6303 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6304 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6305 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
6306 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6307
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6308 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6309 * 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
6310 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6311 * 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
6312 * 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
6313 * 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
6314 */
511
80dbd5a1f403 Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 510
diff changeset
6315 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
6316 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6317 return WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6318 WC_SCROLLBAR,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6319 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6320 WS_VISIBLE | SBS_AUTOTRACK |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6321 (vertical ? SBS_VERT : SBS_HORZ),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6322 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6323 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6324 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
6325 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6326 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6327 NULL);
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6328 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6329
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6330 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
6331 * Create a new percent bar window (widget) to be packed.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6332 * 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
6333 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6334 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6335 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
6336 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6337 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6338 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6339 WC_SLIDER,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6340 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6341 WS_VISIBLE | SLS_READONLY
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6342 | SLS_RIBBONSTRIP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6343 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6344 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6345 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
6346 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6347 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6348 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6349 blah->oldproc = WinSubclassWindow(tmp, _percentproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6350 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6351 dw_window_disable(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6352 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6353 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6354
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6355 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6356 * Create a new checkbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6357 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6358 * 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
6359 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6360 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6361 HWND API dw_checkbox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6362 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6363 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6364 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6365 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6366 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6367 WS_VISIBLE | BS_AUTOCHECKBOX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6368 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6369 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6370 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6371 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6372 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6373 NULL);
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6374 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6375 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6376 dw_window_set_font(tmp, DefaultFont);
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
6377 dw_window_set_color(tmp, DW_CLR_BLACK, DW_RGB_TRANSPARENT);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6378 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6379 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6380
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6381 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6382 * Create a new listbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6383 * 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
6384 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6385 * multi: Multiple select TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6386 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6387 HWND API dw_listbox_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6388 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6389 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6390 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6391 WC_LISTBOX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6392 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6393 WS_VISIBLE | LS_NOADJUSTPOS |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6394 (multi ? LS_MULTIPLESEL : 0),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6395 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6396 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6397 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
6398 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6399 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6400 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6401 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6402 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6403 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6404 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
6405 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6406 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6407
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6408 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6409 * Sets the icon used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6410 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6411 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6412 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6413 */
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
6414 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
6415 {
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
6416 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
6417 WinSendMsg(handle, WM_SETICON, (MPARAM)hptr, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6418 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6419
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6420 /* 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
6421 * 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
6422 */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6423 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
6424 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6425 HFILE BitmapFileHandle = NULLHANDLE; /* handle for the file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6426 ULONG OpenAction = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6427 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
6428 FILESTATUS BitmapStatus;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6429 ULONG cbRead;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6430 PBITMAPFILEHEADER2 pBitmapFileHeader;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6431 PBITMAPINFOHEADER2 pBitmapInfoHeader;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6432 ULONG ScanLines, ulFlags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6433 HPS hps1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6434 HDC hdc1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6435 SIZEL sizl = { 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6436
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6437 /* open bitmap file */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6438 DosOpen((PSZ)file, &BitmapFileHandle, &OpenAction, 0L,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6439 FILE_ARCHIVED | FILE_NORMAL | FILE_READONLY,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6440 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
6441 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6442 OPEN_FLAGS_NOINHERIT, 0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6443
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6444 if(!BitmapFileHandle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6445 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6446
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6447 /* find out how big the file is */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6448 DosQueryFileInfo(BitmapFileHandle, 1, &BitmapStatus,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6449 sizeof(BitmapStatus));
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 /* allocate memory to load the bitmap */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6452 DosAllocMem((PPVOID)&BitmapFileBegin, (ULONG)BitmapStatus.cbFile,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6453 PAG_READ | PAG_WRITE | PAG_COMMIT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6454
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6455 /* read bitmap file into memory buffer */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6456 DosRead(BitmapFileHandle, (PVOID)BitmapFileBegin,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6457 BitmapStatus.cbFile, &cbRead);
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 /* access first bytes as bitmap header */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6460 pBitmapFileHeader = (PBITMAPFILEHEADER2)BitmapFileBegin;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6461
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6462 /* check if it's a valid bitmap data file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6463 if((pBitmapFileHeader->usType != BFT_BITMAPARRAY) &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6464 (pBitmapFileHeader->usType != BFT_BMAP))
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 /* free memory of bitmap file buffer */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6467 DosFreeMem(BitmapFileBegin);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6468 /* close the bitmap file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6469 DosClose(BitmapFileHandle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6470 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6471 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6472
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6473 /* check if it's a file with multiple bitmaps */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6474 if(pBitmapFileHeader->usType == BFT_BITMAPARRAY)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6475 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6476 /* 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
6477 pBitmapFileHeader = &(((PBITMAPARRAYFILEHEADER2)BitmapFileBegin)->bfh2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6478 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6479
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6480 /* set pointer to bitmap information block */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6481 pBitmapInfoHeader = &pBitmapFileHeader->bmp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6482
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6483 /* 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
6484 /* and query number of lines */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6485 if(pBitmapInfoHeader->cbFix == sizeof(BITMAPINFOHEADER))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6486 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6487 *height = ScanLines = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6488 *width = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6489 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6490 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6491 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6492 *height = ScanLines = pBitmapInfoHeader->cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6493 *width = pBitmapInfoHeader->cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6494 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6495
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6496 /* 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
6497 hps1 = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6498
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6499 hdc1 = GpiQueryDevice(hps1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6500 ulFlags = GpiQueryPS(hps1, &sizl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6501
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6502 *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
6503 *hps = GpiCreatePS (dwhab, *hdc, &sizl, ulFlags | GPIA_ASSOC);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6504
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6505 /* 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
6506 *hbm = GpiCreateBitmap(*hps, pBitmapInfoHeader, 0L, NULL, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6507
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6508 /* select the new bitmap into presentation space */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6509 GpiSetBitmap(*hps, *hbm);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6510
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6511 /* now copy the bitmap data into the bitmap */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6512 GpiSetBitmapBits(*hps, 0L, ScanLines,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6513 BitmapFileBegin + pBitmapFileHeader->offBits,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6514 (PBITMAPINFO2)pBitmapInfoHeader);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6515
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6516 WinReleasePS(hps1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6517
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6518 /* free memory of bitmap file buffer */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6519 DosFreeMem(BitmapFileBegin);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6520 /* close the bitmap file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6521 DosClose(BitmapFileHandle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6522 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
6523 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6524
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6525 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6526 * Sets the bitmap used for a given static window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6527 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6528 * 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
6529 * 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
6530 * (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
6531 * 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
6532 * 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
6533 * 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
6534 */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6535 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6536 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6537 HBITMAP hbm;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6538 HPS hps;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6539
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6540 /* Destroy any old bitmap data */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6541 _free_bitmap(handle);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6542
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6543 /* 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
6544 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6545 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6546 hps = WinGetPS( handle );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6547 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
6548 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6549 else if ( filename )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6550 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6551 HDC hdc;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6552 unsigned long width, height;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6553 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6554
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6555 if(!file)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6556 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6557
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6558 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6559
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6560 /* 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
6561 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6562 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6563 /* Try with .bmp extention */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6564 strcat(file, ".bmp");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6565 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6566 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6567 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6568
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6569 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
6570 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6571
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6572 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
6573 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
6574 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
6575 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
6576 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6577 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6578 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6579
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6580 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
6581 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
6582 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6583 WinReleasePS(hps);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6584 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm);
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6585
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6586 /* If we changed the bitmap... */
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6587 {
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6588 Item *item = _box_item(handle);
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6589
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6590 /* Check to see if any of the sizes need to be recalculated */
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6591 if(item && (item->origwidth == -1 || item->origheight == -1))
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6592 {
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6593 _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL);
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6594 /* Queue a redraw on the top-level window */
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6595 _dw_redraw(_toplevel_window(handle), TRUE);
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6596 }
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6597 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6598 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6599
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6600 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6601 * 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
6602 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6603 * handle: Handle to the window.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6604 * 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
6605 * (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
6606 * 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
6607 * 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
6608 * 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
6609 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6610 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
6611 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6612 HBITMAP hbm;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6613 HPS hps;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6614 HDC hdc;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6615 unsigned long width, height;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6616 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6617 FILE *fp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6618
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6619 /* Destroy any old bitmap data */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6620 _free_bitmap(handle);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6621
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6622 /* 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
6623 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6624 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6625 hps = WinGetPS( handle );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6626 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
6627 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6628 else if ( data )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6629 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6630 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6631 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6632 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6633 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6634 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6635 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6636 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6637 fclose( fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6638 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
6639 _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
6640 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
6641 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6642 /* con't use ICO ? */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6643 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6644 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6645 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6646 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6647 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6648 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6649 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6650 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6651 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6652 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6653 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6654
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6655 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
6656 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
6657 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
6658 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
6659 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6660 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6661 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6662
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6663 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
6664 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
6665 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6666 WinReleasePS(hps);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6667 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm);
3
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6671 * Sets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6672 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6673 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6674 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6675 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6676 void API dw_window_set_text(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6677 {
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
6678 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
6679 WinSetWindowText(entryfield ? entryfield : handle, (PSZ)text);
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6680 /* If we changed the text... */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6681 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6682 Item *item = _box_item(handle);
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6683
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6684 /* Check to see if any of the sizes need to be recalculated */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6685 if(item && (item->origwidth == -1 || item->origheight == -1))
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6686 {
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6687 _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL);
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6688 /* Queue a redraw on the top-level window */
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6689 _dw_redraw(_toplevel_window(handle), TRUE);
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6690 }
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6691 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6692 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6693
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6694 /*
1389
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6695 * 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
6696 * Parameters:
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6697 * 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
6698 * 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
6699 */
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6700 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
6701 {
1398
152e3c8916de Set tooltip on the entryfield part of a combobox...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1397
diff changeset
6702 HWND buddy = (HWND)dw_window_get_data(handle, "_dw_comboentry");
152e3c8916de Set tooltip on the entryfield part of a combobox...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1397
diff changeset
6703 WindowData *blah = (WindowData *)WinQueryWindowPtr(buddy ? buddy : handle, QWP_USER);
1400
ccd383e11ff8 Allow removing of tooltips by passing NULL or "" and prevent double tooltips on some platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1398
diff changeset
6704 char *text = bubbletext ? bubbletext : "";
1398
152e3c8916de Set tooltip on the entryfield part of a combobox...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1397
diff changeset
6705
152e3c8916de Set tooltip on the entryfield part of a combobox...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1397
diff changeset
6706 buddy = (HWND)dw_window_get_data(handle, "_dw_buddy");
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
6707
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
6708 if(blah)
1400
ccd383e11ff8 Allow removing of tooltips by passing NULL or "" and prevent double tooltips on some platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1398
diff changeset
6709 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1);
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
6710 if(buddy && (blah = (WindowData *)WinQueryWindowPtr(buddy, QWP_USER)))
1400
ccd383e11ff8 Allow removing of tooltips by passing NULL or "" and prevent double tooltips on some platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1398
diff changeset
6711 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1);
1389
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6712 }
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6713
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6714 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6715 * Gets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6716 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6717 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6718 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6719 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6720 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6721 char * API dw_window_get_text(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6722 {
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
6723 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
6724 int len = WinQueryWindowTextLength(entryfield ? entryfield : handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6725 char *tempbuf = calloc(1, len + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6726
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6727 WinQueryWindowText(entryfield ? entryfield : handle, len + 1, (PSZ)tempbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6728
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6729 return tempbuf;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6730 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6731
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6732 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6733 * Disables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6734 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6735 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6736 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6737 void API dw_window_disable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6738 {
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
6739 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6740
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
6741 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
6742 {
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
6743 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
6744 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
6745
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
6746 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
6747 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
6748
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
6749 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
6750 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
6751 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
6752 }
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
6753
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6754 if(dw_window_get_data(handle, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6755 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6756
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6757 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6758 dw_window_set_data(handle, "_dw_disabled", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6759
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6760 if(tmpbuf[0] == '#')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6761 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6762 int val = atoi(&tmpbuf[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6763 HWND hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6764
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6765 switch(val)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6766 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6767 case 2:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6768 case 6:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6769 case 10:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6770 case 32:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6771 case 7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6772 hwnd = _find_entryfield(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6773 _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
6774 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
6775 if(val == 2)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6776 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
6777 if(hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6778 dw_window_set_data(hwnd, "_dw_disabled", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6779 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6780 case 3:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6781 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
6782 WinEnableWindow(handle, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6783 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
6784 WinInvalidateRect(handle, NULL, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6785 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6786 _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
6787 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
6788 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
6789 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6790 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6791 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6792 WinEnableWindow(handle, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6793 }
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 * Enables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6797 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6798 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6799 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6800 void API dw_window_enable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6801 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6802 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
6803 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
6804 HWND hwnd = _find_entryfield(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6805
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
6806 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
6807 {
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
6808 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
6809 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
6810
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
6811 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
6812 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
6813
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
6814 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
6815 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
6816 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
6817 }
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
6818
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6819 dw_window_set_data(handle, "_dw_disabled", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6820 if(hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6821 dw_window_set_data(hwnd, "_dw_disabled", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6822 if(fore && back)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6823 _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
6824 dw_signal_disconnect_by_data(handle, (void *)100);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6825 WinEnableWindow(handle, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6826 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
6827 WinInvalidateRect(handle, NULL, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6828 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6829
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6830 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6831 * Gets the child window handle with specified ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6832 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6833 * handle: Handle to the parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6834 * id: Integer ID of the child.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6835 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6836 HWND API dw_window_from_id(HWND handle, int id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6837 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6838 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6839 HWND child;
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
6840 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6841
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6842 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6843 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6844 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6845 int windowid = WinQueryWindowUShort(child, QWS_ID);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6846 HWND found;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6847
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6848 WinQueryClassName(child, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6849
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6850 /* 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
6851 if(strncmp(tmpbuf, "#1", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6852 if((found = dw_window_from_id(child, id)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6853 return found;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6854
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6855 if(windowid && windowid == id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6856 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6857 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6858 return child;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6861 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6862 return NULLHANDLE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6863 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6864
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
6865 /* 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
6866 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
6867 {
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
6868 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
6869
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
6870 /*
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
6871 * 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
6872 * 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
6873 */
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
6874 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
6875 {
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
6876 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
6877 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
6878 }
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
6879
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
6880 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
6881 {
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
6882 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
6883 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
6884 {
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
6885 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
6886 }
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
6887 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
6888 {
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
6889 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
6890 }
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
6891 }
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
6892
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
6893 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
6894
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
6895 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
6896 {
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
6897 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
6898 Item *tmpitem, *thisitem = thisbox->items;
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
6899 char tmpbuf[100] = {0};
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
6900 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
6901
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
6902 /* 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
6903 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
6904 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
6905 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
6906 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
6907
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
6908 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
6909
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
6910 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
6911 {
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
6912 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
6913 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
6914 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
6915 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
6916 }
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
6917
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
6918
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6919 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
6920
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
6921 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
6922 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
6923 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
6924 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
6925
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
6926 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
6927 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
6928 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
6929 {
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
6930 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
6931 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
6932 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
6933 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
6934
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
6935 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
6936 }
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
6937
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
6938 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
6939 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
6940 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
6941 tmpitem[index].pad = pad;
1411
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6942 tmpitem[index].hsize = hsize ? SIZEEXPAND : SIZESTATIC;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6943 tmpitem[index].vsize = vsize ? SIZEEXPAND : SIZESTATIC;
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6944
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6945 /* If either of the parameters are -1 ... calculate the size */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6946 if(width == -1 || height == -1)
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
6947 _control_size(item, width == -1 ? &tmpitem[index].width : NULL, height == -1 ? &tmpitem[index].height : NULL);
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
6948
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
6949 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
6950
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
6951 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
6952 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
6953
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
6954 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
6955
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6956 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
6957 /* 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
6958 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
6959 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
6960 WinSetParent(frame ? frame : item, box, FALSE);
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
6961 _handle_transparent(box);
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6962 /* Queue a redraw on the top-level window */
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
6963 _dw_redraw(_toplevel_window(item), TRUE);
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
6964 }
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
6965 }
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
6966
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
6967 /*
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
6968 * 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
6969 * 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
6970 * 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
6971 * 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
6972 * 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
6973 * 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
6974 * 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
6975 * 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
6976 * 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
6977 * 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
6978 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6979 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
6980 {
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6981 _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
6982 }
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6983
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6984 /*
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6985 * 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
6986 * 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
6987 * 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
6988 * 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
6989 * 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
6990 * 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
6991 * 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
6992 * 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
6993 * 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
6994 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6995 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
6996 {
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6997 /* 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
6998 * 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
6999 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7000 _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
7001 }
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7002
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7003 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7004 * Pack windows (widgets) into a box from the end (or bottom).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7005 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7006 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7007 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7008 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7009 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7010 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7011 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7012 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7013 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7014 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
7015 {
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
7016 _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
7017 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7018
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7019 /*
1444
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7020 * The following is an attempt to dynamically size a window based on the size of its
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7021 * children before realization. Only applicable when width or height is less than one.
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7022 */
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7023 void _get_window_for_size(HWND handle, unsigned long *width, unsigned long *height)
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7024 {
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7025 HWND box = WinWindowFromID(handle, FID_CLIENT);
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7026 Box *thisbox = WinQueryWindowPtr(box, QWP_USER);
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7027
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7028 if(thisbox)
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7029 {
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7030 int depth = 0;
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7031 RECTL rect = { 0 };
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7032
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7033 /* Calculate space requirements */
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7034 _resize_box(thisbox, &depth, *width, *height, 1);
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7035
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7036 rect.xRight = thisbox->minwidth;
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7037 rect.yTop = thisbox->minheight;
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7038
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7039 /* Take into account the window border and menu here */
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7040 WinCalcFrameRect(handle, &rect, FALSE);
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7041
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7042 if(*width < 1) *width = rect.xRight - rect.xLeft;
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7043 if(*height < 1) *height = rect.yTop - rect.yBottom;
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7044 }
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7045 }
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7046
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7047 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7048 * Sets the size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7049 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7050 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7051 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7052 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7053 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7054 void API dw_window_set_size(HWND handle, ULONG width, ULONG height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7055 {
1444
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7056 /* Attempt to auto-size */
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7057 if ( width < 1 || height < 1 )
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7058 _get_window_for_size(handle, &width, &height);
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
7059
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
7060 /* Finally set the size */
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
7061 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SIZE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7062 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7063
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7064 /*
1429
fbaec6e5df63 Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1428
diff changeset
7065 * Gets the size the system thinks the widget should be.
fbaec6e5df63 Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1428
diff changeset
7066 * Parameters:
fbaec6e5df63 Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1428
diff changeset
7067 * handle: Window handle of the item to be back.
fbaec6e5df63 Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1428
diff changeset
7068 * width: Width in pixels of the item or NULL if not needed.
fbaec6e5df63 Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1428
diff changeset
7069 * height: Height in pixels of the item or NULL if not needed.
fbaec6e5df63 Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1428
diff changeset
7070 */
fbaec6e5df63 Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1428
diff changeset
7071 void API dw_window_get_preferred_size(HWND handle, int *width, int *height)
fbaec6e5df63 Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1428
diff changeset
7072 {
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7073 char tmpbuf[100] = {0};
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7074
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7075 WinQueryClassName(handle, 99, (PCH)tmpbuf);
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7076
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7077 if(strncmp(tmpbuf, "#1", 3)==0)
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7078 {
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7079 HWND box = WinWindowFromID(handle, FID_CLIENT);
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7080
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7081 if(box)
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7082 {
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7083 unsigned long thiswidth = 0, thisheight = 0;
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7084
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7085 /* Get the size with the border */
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7086 _get_window_for_size(handle, &thiswidth, &thisheight);
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7087
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7088 /* Return what was requested */
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7089 if(width) *width = (int)thiswidth;
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7090 if(height) *height = (int)thisheight;
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7091 }
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7092 else
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7093 {
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7094 Box *thisbox = WinQueryWindowPtr(handle, QWP_USER);
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7095
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7096 if(thisbox)
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7097 {
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7098 int depth = 0;
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7099
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7100 /* Calculate space requirements */
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7101 _resize_box(thisbox, &depth, 0, 0, 1);
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7102
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7103 /* Return what was requested */
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7104 if(width) *width = thisbox->minwidth;
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7105 if(height) *height = thisbox->minheight;
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7106 }
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7107 }
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7108 }
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7109 else
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7110 _control_size(handle, width, height);
1429
fbaec6e5df63 Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1428
diff changeset
7111 }
fbaec6e5df63 Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1428
diff changeset
7112
fbaec6e5df63 Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1428
diff changeset
7113 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7114 * Returns the width of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7115 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7116 int API dw_screen_width(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7117 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7118 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7119 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7120
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7121 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7122 * Returns the height of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7123 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7124 int API dw_screen_height(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7125 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7126 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7127 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7128
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7129 /* 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
7130 unsigned long API dw_color_depth_get(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7131 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7132 HDC hdc = WinOpenWindowDC(HWND_DESKTOP);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7133 long colors;
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 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7136 DevCloseDC(hdc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7137 return colors;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7138 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7139
1473
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7140 /*
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7141 * Sets the gravity of a given window (widget).
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7142 * Gravity controls which corner of the screen and window the position is relative to.
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7143 * Parameters:
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7144 * handle: Window (widget) handle.
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7145 * horz: DW_GRAV_LEFT (default), DW_GRAV_RIGHT or DW_GRAV_CENTER.
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7146 * vert: DW_GRAV_TOP (default), DW_GRAV_BOTTOM or DW_GRAV_CENTER.
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7147 */
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7148 void API dw_window_set_gravity(HWND handle, int horz, int vert)
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7149 {
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7150 dw_window_set_data(handle, "_dw_grav_horz", DW_INT_TO_POINTER(horz));
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7151 dw_window_set_data(handle, "_dw_grav_vert", DW_INT_TO_POINTER(vert));
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7152 }
4468ac1db710 Fixes building on OS/2 and reverted a change where I tried to not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1472
diff changeset
7153
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7154 /* Convert the coordinates based on gravity */
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7155 void _handle_gravity(HWND handle, long *x, long *y, unsigned long width, unsigned long height)
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7156 {
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7157 int horz = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_horz"));
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7158 int vert = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_vert"));
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7159
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7160 /* Do any gravity calculations */
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7161 if(horz || (vert & 0xf) != DW_GRAV_BOTTOM)
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7162 {
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7163 long newx = *x, newy = *y;
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7164
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7165 /* Handle horizontal center gravity */
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7166 if((horz & 0xf) == DW_GRAV_CENTER)
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7167 newx += ((dw_screen_width() / 2) - (width / 2));
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7168 /* Handle right gravity */
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7169 else if((horz & 0xf) == DW_GRAV_RIGHT)
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7170 newx = dw_screen_width() - width - *x;
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7171 /* Handle vertical center gravity */
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7172 if((vert & 0xf) == DW_GRAV_CENTER)
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7173 newy += ((dw_screen_height() / 2) - (height / 2));
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7174 else if((vert & 0xf) == DW_GRAV_TOP)
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7175 newy = dw_screen_height() - height - *y;
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7176
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7177 /* Save the new values */
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7178 *x = newx;
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7179 *y = newy;
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7180 }
1495
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7181 /* Adjust the values to avoid WarpCenter/XCenter/eCenter if requested */
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7182 if(_WinQueryDesktopWorkArea && (horz | vert) & DW_GRAV_OBSTACLES)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7183 {
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7184 RECTL rect;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7185
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7186 _WinQueryDesktopWorkArea(HWND_DESKTOP, &rect);
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7187
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7188 if(horz & DW_GRAV_OBSTACLES)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7189 {
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7190 if((horz & 0xf) == DW_GRAV_LEFT)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7191 *x += rect.xLeft;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7192 else if((horz & 0xf) == DW_GRAV_RIGHT)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7193 *x -= dw_screen_width() - rect.xRight;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7194 }
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7195 if(vert & DW_GRAV_OBSTACLES)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7196 {
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7197 if((vert & 0xf) == DW_GRAV_BOTTOM)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7198 *y += rect.yBottom;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7199 else if((vert & 0xf) == DW_GRAV_TOP)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7200 *y -= dw_screen_height() - rect.yTop;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7201 }
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7202 }
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7203 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7204
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7205 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7206 * Sets the position of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7207 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7208 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7209 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7210 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7211 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7212 void API dw_window_set_pos(HWND handle, LONG x, LONG y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7213 {
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7214 unsigned long width, height;
1498
f8b4d6075cac Added auto-size support during dw_window_set_pos() on OS/2, Mac and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1495
diff changeset
7215
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7216 dw_window_get_pos_size(handle, NULL, NULL, &width, &height);
1498
f8b4d6075cac Added auto-size support during dw_window_set_pos() on OS/2, Mac and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1495
diff changeset
7217 /* Can't position an unsized window, so attempt to auto-size */
f8b4d6075cac Added auto-size support during dw_window_set_pos() on OS/2, Mac and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1495
diff changeset
7218 if(width == 0 || height == 0)
f8b4d6075cac Added auto-size support during dw_window_set_pos() on OS/2, Mac and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1495
diff changeset
7219 {
f8b4d6075cac Added auto-size support during dw_window_set_pos() on OS/2, Mac and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1495
diff changeset
7220 dw_window_set_size(handle, 0, 0);
f8b4d6075cac Added auto-size support during dw_window_set_pos() on OS/2, Mac and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1495
diff changeset
7221 dw_window_get_pos_size(handle, NULL, NULL, &width, &height);
f8b4d6075cac Added auto-size support during dw_window_set_pos() on OS/2, Mac and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1495
diff changeset
7222 }
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7223 _handle_gravity(handle, &x, &y, width, height);
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7224 WinSetWindowPos(handle, NULLHANDLE, x, y, 0, 0, SWP_MOVE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7225 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7226
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7227 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7228 * Sets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7229 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7230 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7231 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7232 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7233 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7234 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7235 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7236 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
7237 {
1444
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7238 /* Attempt to auto-size */
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7239 if ( width < 1 || height < 1 )
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7240 _get_window_for_size(handle, &width, &height);
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
7241
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7242 _handle_gravity(handle, &x, &y, width, height);
1438
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
7243 /* Finally set the size */
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
7244 WinSetWindowPos(handle, NULLHANDLE, x, y, width, height, SWP_MOVE | SWP_SIZE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7245 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7246
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7247 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7248 * Gets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7249 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7250 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7251 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7252 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7253 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7254 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7255 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7256 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
7257 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7258 SWP swp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7259 WinQueryWindowPos(handle, &swp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7260 if(x)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7261 *x = swp.x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7262 if(y)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7263 *y = _get_frame_height(handle) - (swp.y + swp.cy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7264 if(width)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7265 *width = swp.cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7266 if(height)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7267 *height = swp.cy;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7268 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7269
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7270 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7271 * Sets the style of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7272 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7273 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7274 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7275 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7276 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7277 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7278 {
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
7279 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
7280 {
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7281 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
7282 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
7283
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7284 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
7285 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
7286
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7287 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
7288 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
7289 }
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7290 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
7291 WinSetWindowBits(handle, QWL_STYLE, style, mask);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7292 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7293
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7294 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7295 * Adds a new page to specified notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7296 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7297 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7298 * flags: Any additional page creation flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7299 * front: If TRUE page is added at the beginning.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7300 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7301 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7302 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7303 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7304 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), front ? BKA_FIRST : BKA_LAST));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7305 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7306
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7307 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7308 * Remove a page from a notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7309 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7310 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7311 * pageid: ID of the page to be destroyed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7312 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7313 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7314 {
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
7315 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
7316 MPFROMLONG(pageid), 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7317 WinSendMsg(handle, BKM_DELETEPAGE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7318 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
7319 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
7320 dw_window_destroy(pagehwnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7321 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7322
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7323 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7324 * Queries the currently visible page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7325 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7326 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7327 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7328 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
7329 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7330 return (unsigned long)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7331 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7332
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7333 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7334 * Sets the currently visibale page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7335 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7336 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7337 * pageid: ID of the page to be made visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7338 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7339 void API dw_notebook_page_set(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7340 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7341 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7342 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7343
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7344 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7345 * Sets the text on the specified notebook tab.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7346 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7347 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7348 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7349 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7350 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7351 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7352 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7353 WinSendMsg(handle, BKM_SETTABTEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7354 MPFROMLONG(pageid), MPFROMP(text));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7355 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7356
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7357 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7358 * Sets the text on the specified notebook tab status area.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7359 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7360 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7361 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7362 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7363 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7364 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7365 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7366 WinSendMsg(handle, BKM_SETSTATUSLINETEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7367 MPFROMLONG(pageid), MPFROMP(text));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7368 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7369
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7370 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7371 * Packs the specified box into the notebook page.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7372 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7373 * handle: Handle to the notebook to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7374 * pageid: Page ID in the notebook which is being packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7375 * page: Box handle to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7376 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7377 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7378 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7379 HWND tmpbox = dw_box_new(DW_VERT, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7380
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7381 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
7382 WinSubclassWindow(tmpbox, _wndproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7383 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7384 MPFROMLONG(pageid), MPFROMHWND(tmpbox));
3
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7388 * Appends the specified text to the listbox's (or combobox) entry list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7389 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7390 * handle: Handle to the listbox to be appended to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7391 * text: Text to append into listbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7392 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7393 void API dw_listbox_append(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7394 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7395 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7396 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7397 MPFROMSHORT(LIT_END),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7398 MPFROMP(text));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7399 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7400
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7401 /*
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7402 * 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
7403 * Parameters:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7404 * handle: Handle to the listbox to be inserted into.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7405 * text: Text to insert into listbox.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7406 * pos: 0-based position to insert text
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7407 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7408 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
7409 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7410 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7411 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7412 MPFROMSHORT(pos),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7413 MPFROMP(text));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7414 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7415
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7416 /*
571
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7417 * 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
7418 * Parameters:
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7419 * 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
7420 * text: Text strings to append into listbox.
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7421 * count: Number of text strings to append
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7422 */
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7423 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
7424 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7425 int i;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7426 for(i=0;i<count;i++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7427 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7428 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7429 MPFROMSHORT(LIT_END),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7430 MPFROMP(text[i]));
571
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7431 }
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7432
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7433 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7434 * Clears the listbox's (or combobox) list of all entries.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7435 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7436 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7437 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7438 void API dw_listbox_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7439 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7440 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7441 LM_DELETEALL, 0L, 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7442 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7443
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7444 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7445 * Returns the listbox's item count.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7446 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7447 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7448 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7449 int API dw_listbox_count(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7450 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7451 return (int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7452 LM_QUERYITEMCOUNT,0L, 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7453 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7454
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7455 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7456 * Sets the topmost item in the viewport.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7457 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7458 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7459 * top: Index to the top item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7460 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7461 void API dw_listbox_set_top(HWND handle, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7462 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7463 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7464 LM_SETTOPINDEX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7465 MPFROMSHORT(top),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7466 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7467 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7468
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7469 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7470 * Copies the given index item's text into buffer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7471 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7472 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7473 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7474 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7475 * length: Length of the buffer (including NULL).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7476 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7477 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
7478 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7479 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7480 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7481
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7482 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7483 * Sets the text of a given listbox entry.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7484 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7485 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7486 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7487 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7488 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7489 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7490 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7491 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7492 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7493
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7494 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7495 * Returns the index to the item in the list currently selected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7496 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7497 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7498 */
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
7499 int API dw_listbox_selected(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7500 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7501 return (unsigned int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7502 LM_QUERYSELECTION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7503 MPFROMSHORT(LIT_CURSOR),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7504 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7505 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7506
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7507 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7508 * Returns the index to the current selected item or -1 when done.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7509 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7510 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7511 * where: Either the previous return or -1 to restart.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7512 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7513 int API dw_listbox_selected_multi(HWND handle, int where)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7514 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7515 int place = where;
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(where == -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7518 place = LIT_FIRST;
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 place = (int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7521 LM_QUERYSELECTION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7522 MPFROMSHORT(place),0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7523 if(place == LIT_NONE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7524 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7525 return place;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7526 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7527
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7528 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7529 * Sets the selection state of a given index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7530 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7531 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7532 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7533 * state: TRUE if selected FALSE if unselected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7534 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7535 void API dw_listbox_select(HWND handle, int index, int state)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7536 {
1531
783a464afab2 Added window and box support to dw_window_get_preferred_size() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1528
diff changeset
7537 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7538
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7539 WinSendMsg(handle, LM_SELECTITEM, MPFROMSHORT(index), (MPARAM)state);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7540
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7541 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7542
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7543 /* 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
7544 if(strncmp(tmpbuf, "#6", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7545 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7546 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7547
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7548 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7549 * Deletes the item with given index from the list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7550 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7551 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7552 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7553 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7554 void API dw_listbox_delete(HWND handle, int index)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7555 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7556 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7557 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7558
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7559 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7560 * Adds text to an MLE box and returns the current point.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7561 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7562 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7563 * buffer: Text buffer to be imported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7564 * startpoint: Point to start entering text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7565 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7566 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7567 {
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
7568 long point = startpoint < 0 ? 0 : startpoint;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7569 PBYTE mlebuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7570
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7571 /* Work around 64K limit */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7572 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
7573 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7574 int amount, len = strlen(buffer), written = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7575
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7576 while(written < len)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7577 {
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7578 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
7579
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7580 if((len - written) > 65535)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7581 amount = 65535;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7582 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7583 amount = len - written;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7584
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7585 /* 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
7586 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
7587 {
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7588 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
7589 {
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7590 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
7591 x++;
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7592 }
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7593 }
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7594
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7595 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
7596 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
7597 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
7598 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(x));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7599
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7600 written += amount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7601 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7602 DosFreeMem(mlebuf);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7603 }
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7604 return point;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7605 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7606
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7607 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7608 * Grabs text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7609 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7610 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7611 * buffer: Text buffer to be exported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7612 * startpoint: Point to start grabbing text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7613 * length: Amount of text to be grabbed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7614 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7615 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7616 {
1000
99907f19a703 Minor fixed and code cleanups on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 996
diff changeset
7617 PBYTE mlebuf;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7618
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7619 /* Work around 64K limit */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7620 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
7621 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7622 int amount, copied, written = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7623
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7624 while(written < length)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7625 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7626 if((length - written) > 65535)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7627 amount = 65535;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7628 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7629 amount = length - written;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7630
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7631 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7632 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
7633
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7634 if(copied)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7635 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7636 memcpy(&buffer[written], mlebuf, copied);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7637
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7638 written += copied;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7639 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7640 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7641 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7642 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7643 DosFreeMem(mlebuf);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7644 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7645 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7646
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7647 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7648 * Obtains information about an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7649 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7650 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7651 * bytes: A pointer to a variable to return the total bytes.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7652 * lines: A pointer to a variable to return the number of lines.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7653 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7654 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7655 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7656 if(bytes)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7657 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7658 if(lines)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7659 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7660 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7661
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7662 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7663 * Deletes text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7664 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7665 * handle: Handle to the MLE to be deleted from.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7666 * startpoint: Point to start deleting text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7667 * length: Amount of text to be deleted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7668 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7669 void API dw_mle_delete(HWND handle, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7670 {
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7671 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(length));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7672 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7673
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7674 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7675 * Clears all text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7676 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7677 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7678 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7679 void API dw_mle_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7680 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7681 unsigned long bytes;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7682
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7683 dw_mle_get_size(handle, &bytes, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7684
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7685 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7686 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7687
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7688 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7689 * Sets the visible line of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7690 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7691 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7692 * line: Line to be visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7693 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
7694 void API dw_mle_set_visible(HWND handle, int line)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7695 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7696 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
7697 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(tmppnt), MPFROMLONG(tmppnt));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7698 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7699
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7700 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7701 * Sets the editablity of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7702 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7703 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7704 * 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
7705 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
7706 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
7707 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7708 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
7709 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7710
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7711 /*
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7712 * Sets the word wrap state of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7713 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7714 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7715 * 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
7716 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
7717 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
7718 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7719 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7720 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7721
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7722 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7723 * Sets the current cursor position of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7724 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7725 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7726 * point: Point to position cursor.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7727 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7728 void API dw_mle_set_cursor(HWND handle, int point)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7729 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7730 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7731 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7732
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7733 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7734 * Finds text in an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7735 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7736 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7737 * text: Text to search for.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7738 * point: Start point of search.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7739 * flags: Search specific flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7740 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7741 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7742 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7743 MLE_SEARCHDATA msd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7744
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7745 /* 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
7746 * 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
7747 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7748 msd.cb = sizeof(msd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7749 msd.pchFind = text;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7750 msd.pchReplace = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7751 msd.cchFind = strlen(text);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7752 msd.cchReplace = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7753 msd.iptStart = point;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7754 msd.iptStop = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7755
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7756 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
7757 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
7758 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7759 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7760
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7761 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7762 * Stops redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7763 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7764 * handle: Handle to the MLE to freeze.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7765 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7766 void API dw_mle_freeze(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7767 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7768 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7769 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7770
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7771 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7772 * Resumes redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7773 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7774 * handle: Handle to the MLE to thaw.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7775 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7776 void API dw_mle_thaw(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7777 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7778 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7779 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7780
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7781 /* 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
7782 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
7783 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7784 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
7785
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7786 if(range)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7787 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7788 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
7789
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7790 if(mypos >= range)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7791 mypos = range - 1;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7792
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7793 _dw_int_set(handle, mypos);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7794 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
7795 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7796 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7797
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7798 /* 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
7799 void _percentthread(void *data)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7800 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7801 HWND percent = (HWND)data;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7802
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7803 if(percent)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7804 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7805 HAB thishab = WinInitialize(0);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7806 HMQ thishmq = WinCreateMsgQueue(dwhab, 0);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7807
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7808 int pos = 100;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7809
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7810 do
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7811 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7812 pos--;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7813 if(pos < 1)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7814 pos = 100;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7815 _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
7816 DosSleep(100);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7817 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7818 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
7819
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7820 WinDestroyMsgQueue(thishmq);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7821 WinTerminate(thishab);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7822 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7823 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7824
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7825 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
7826 * Sets the percent bar position.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7827 * 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
7828 * 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
7829 * position: Position of the percent bar withing the range.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7830 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7831 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
7832 {
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
7833 /* 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
7834 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
7835 {
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7836 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
7837 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7838 /* 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
7839 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
7840 _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
7841 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7842 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7843 else
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7844 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7845 /* 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
7846 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
7847 /* 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
7848 _dw_percent_set_pos(handle, position);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7849 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7850 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7851
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7852 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7853 * 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
7854 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7855 * 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
7856 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7857 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
7858 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7859 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
7860 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7861
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7862 /*
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7863 * 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
7864 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7865 * 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
7866 * 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
7867 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7868 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
7869 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7870 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
7871 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
7872 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7873
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7874 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7875 * 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
7876 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7877 * 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
7878 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7879 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
7880 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7881 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
7882 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7883
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7884 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7885 * 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
7886 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7887 * 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
7888 * 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
7889 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7890 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
7891 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7892 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
7893 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
7894 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7895
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7896 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7897 * 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
7898 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7899 * 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
7900 * 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
7901 * 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
7902 */
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
7903 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
7904 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7905 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
7906 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
7907 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
7908 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
7909 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7910
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7911 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7912 * Sets the spinbutton value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7913 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7914 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7915 * position: Current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7916 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7917 void API dw_spinbutton_set_pos(HWND handle, long position)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7918 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7919 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7920 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7921
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7922 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7923 * Sets the spinbutton limits.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7924 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7925 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7926 * upper: Upper limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7927 * lower: Lower limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7928 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7929 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7930 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7931 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7932 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7933
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7934 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7935 * Sets the entryfield character limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7936 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7937 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7938 * limit: Number of characters the entryfield will take.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7939 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7940 void API dw_entryfield_set_limit(HWND handle, ULONG limit)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7941 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7942 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7943 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7944
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7945
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7946 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7947 * Returns the current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7948 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7949 * handle: Handle to the spinbutton to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7950 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7951 long API dw_spinbutton_get_pos(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7952 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7953 long tmpval = 0L;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7954
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7955 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
7956 return tmpval;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7957 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7958
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7959 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7960 * Returns the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7961 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7962 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7963 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7964 int API dw_checkbox_get(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7965 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7966 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7967 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7968
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7969 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7970 * Sets the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7971 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7972 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7973 * value: TRUE for checked, FALSE for unchecked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7974 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7975 void API dw_checkbox_set(HWND handle, int value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7976 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7977 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7978 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7979
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7980 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
7981 * 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
7982 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7983 * 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
7984 * 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
7985 * 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
7986 * 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
7987 * 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
7988 * 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
7989 */
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
7990 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
7991 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7992 ULONG cbExtra;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7993 PCNRITEM pci;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7994 RECORDINSERT ri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7995
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7996 if(!item)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7997 item = (HTREEITEM)CMA_FIRST;
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 /* 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
8000 * MINIRECORDCORE structure
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8003 cbExtra = sizeof(CNRITEM) - sizeof(MINIRECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8004
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8005 /* Allocate memory for the parent record */
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 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
8008 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8009
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8010 /* Fill in the parent record data */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8011
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8012 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
8013 pci->rc.pszIcon = (PSZ)strdup(title);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8014 pci->rc.hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8015
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8016 pci->hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8017 pci->user = itemdata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8018 pci->parent = parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8019
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8020 memset(&ri, 0, sizeof(RECORDINSERT));
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 ri.cb = sizeof(RECORDINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8023 ri.pRecordOrder = (PRECORDCORE)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8024 ri.zOrder = (USHORT)CMA_TOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8025 ri.cRecordsInsert = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8026 ri.fInvalidateRecord = TRUE;
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 /* 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
8029 * the one we just inserted.
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 ri.pRecordParent = (PRECORDCORE)parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8032
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8033 /* Insert the record */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8034 WinSendMsg(handle, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8035
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8036 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
8037 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8038
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8039 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8040 * 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
8041 * Parameters:
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8042 * 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
8043 * title: The text title of the entry.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8044 * icon: Handle to coresponding icon.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8045 * parent: Parent handle or 0 if root.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8046 * itemdata: Item specific data.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8047 */
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
8048 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
8049 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8050 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
8051 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8052
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8053 /*
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
8054 * 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
8055 * 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
8056 * 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
8057 * 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
8058 * 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
8059 * 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
8060 */
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
8061 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
8062 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8063 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8064
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8065 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8066 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8067
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8068 if(pci->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8069 free(pci->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8070
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8071 pci->rc.pszIcon = (PSZ)strdup(title);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8072 pci->rc.hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8073
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8074 pci->hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8075
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8076 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
8077 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8078
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8079 /*
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
8080 * 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
8081 * 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
8082 * 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
8083 * 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
8084 */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8085 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
8086 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8087 PCNRITEM pci = (PCNRITEM)item;
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 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8090 if(pci)
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8091 return (char *)pci->rc.pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8092 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
8093 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8094
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8095 /*
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8096 * 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
8097 * 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
8098 * 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
8099 * 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
8100 */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8101 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
8102 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8103 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8104
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8105 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8106 if(pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8107 return pci->parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8108 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
8109 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8110
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8111 /*
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
8112 * 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
8113 * 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
8114 * 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
8115 * 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
8116 * 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
8117 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
8118 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
8119 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8120 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8121
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8122 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8123 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8124 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8125
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8126 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
8127 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8128
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8129 /*
317
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8130 * 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
8131 * Parameters:
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8132 * 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
8133 * 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
8134 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8135 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
8136 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8137 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8138
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8139 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8140 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8141 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8142 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
8143 }
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8144
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8145 /*
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
8146 * 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
8147 * 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
8148 * 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
8149 * 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
8150 */
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
8151 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
8152 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8153 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
8154
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8155 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8156 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8157 if(pCore->flRecordAttr & CRA_SELECTED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8158 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
8159 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
8160 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8161 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
8162 lastitem = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8163 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
8164 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8165
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8166 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8167 * Removes all nodes from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8168 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8169 * 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
8170 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8171 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
8172 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8173 dw_container_clear(handle, TRUE);
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8174 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8175
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8176 /*
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
8177 * 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
8178 * 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
8179 * 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
8180 * 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
8181 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8182 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
8183 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8184 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
8185 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8186
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8187 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8188 * 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
8189 * 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
8190 * 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
8191 * 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
8192 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8193 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
8194 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8195 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
8196 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8197
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8198 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8199 * Removes a node from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8200 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8201 * 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
8202 * item: Handle to node to be deleted.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8203 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8204 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
8205 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8206 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8207
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8208 if(!item)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8209 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8210
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8211 if(pci->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8212 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8213 free(pci->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8214 pci->rc.pszIcon = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8215 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8216
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8217 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
8218 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8219
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8220 /* 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
8221 typedef struct _containerinfo {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8222 int count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8223 void *data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8224 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
8225 } ContainerInfo;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8226
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8227 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8228 * Sets up the container columns.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8229 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8230 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8231 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8232 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8233 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8234 * separator: The column number that contains the main separator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8235 * (this item may only be used in OS/2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8236 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8237 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
8238 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8239 PFIELDINFO details, first, left = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8240 FIELDINFOINSERT detin;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8241 CNRINFO cnri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8242 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8243 ULONG size = sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8244 ULONG *offStruct = malloc(count * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8245 ULONG *tempflags = malloc((count+1) * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8246 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8247 ULONG *oldflags = blah ? blah->data : 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(!offStruct || !tempflags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8250 return FALSE;
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 memcpy(tempflags, flags, count * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8253 tempflags[count] = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8254
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8255 blah->data = tempflags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8256 blah->flags = separator;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8257
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8258 if(oldflags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8259 free(oldflags);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8260
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8261 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
8262 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8263 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
8264 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8265
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8266 /* 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
8267 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8268 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8269 offStruct[z] = size;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8270 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8271 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8272 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8273 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8274 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8275 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8276 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8277 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8278 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8279 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8280 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8281
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8282 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
8283
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8284 if(!first)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8285 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8286 free(offStruct);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8287 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8288 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8289
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8290 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8291 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8292 if(z==separator-1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8293 left=details;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8294 details->cb = sizeof(FIELDINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8295 details->flData = flags[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8296 details->flTitle = CFA_FITITLEREADONLY;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8297 details->pTitleData = titles[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8298 details->offStruct = offStruct[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8299 details = details->pNextFieldInfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8300 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8301
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8302 detin.cb = sizeof(FIELDINFOINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8303 detin.fInvalidateFieldInfo = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8304 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8305 detin.cFieldInfoInsert = (ULONG)count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8306
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8307 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8308
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8309 if(count > separator && separator > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8310 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8311 cnri.cb = sizeof(CNRINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8312 cnri.pFieldInfoLast = left;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8313 cnri.xVertSplitbar = 150;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8314
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8315 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
8316 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8317
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8318 cnri.flWindowAttr = CV_DETAIL | CV_MINI | CA_DETAILSVIEWTITLES;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8319 cnri.slBitmapOrIcon.cx = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8320 cnri.slBitmapOrIcon.cy = 16;
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 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
8323
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8324 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
8325 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8326 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8327
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8328 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8329 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8330 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8331 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8332 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8333 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8334 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8335 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8336 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8337 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8338 char **newtitles = malloc(sizeof(char *) * (count + 2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8339 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8340
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8341 newtitles[0] = "Icon";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8342 newtitles[1] = "Filename";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8343
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8344 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
8345 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
8346
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8347 memcpy(&newtitles[2], titles, sizeof(char *) * count);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8348 memcpy(&newflags[2], flags, sizeof(unsigned long) * count);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8349
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8350 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
8351
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8352 free(newtitles);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8353 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
8354 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8355 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8356
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8357 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8358 * Obtains an icon from a module (or header in GTK).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8359 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8360 * module: Handle to module (DLL) in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8361 * id: A unsigned long id int the resources on OS/2 and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8362 * Windows, on GTK this is converted to a pointer
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8363 * to an embedded XPM.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8364 */
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
8365 HICN API dw_icon_load(unsigned long module, unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8366 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8367 return WinLoadPointer(HWND_DESKTOP,module,id);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8368 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8369
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8370 /*
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
8371 * 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
8372 * 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
8373 * 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
8374 * 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
8375 * (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
8376 */
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
8377 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
8378 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8379 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8380
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8381 if(!file)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8382 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8383
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8384 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8385
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8386 /* 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
8387 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8388 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8389 /* Try with .bmp extention */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8390 strcat(file, ".ico");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8391 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8392 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8393 }
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8394 return WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8395 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8396
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8397 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8398 * Obtains an icon from data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8399 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8400 * 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
8401 * DW pick the appropriate file extension.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8402 * (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
8403 */
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
8404 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
8405 {
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
8406 HICN icon=0;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8407 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8408 FILE *fp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8409
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8410 if ( !data )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8411 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8412 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8413 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8414 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8415 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8416 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8417 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8418 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8419 fclose( fp );
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8420 icon = WinLoadFileIcon( (PSZ)file, FALSE );
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8421 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8422 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8423 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8424 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8425 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8426 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8427 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8428 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8429 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
8430 }
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
8431
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
8432 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8433 * Frees a loaded resource in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8434 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8435 * handle: Handle to icon returned by dw_icon_load().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8436 */
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
8437 void API dw_icon_free(HICN handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8438 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8439 WinDestroyPointer(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8440 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8441
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8442 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8443 * Allocates memory used to populate a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8444 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8445 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8446 * rowcount: The number of items to be populated.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8447 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8448 void * API dw_container_alloc(HWND handle, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8449 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8450 WindowData *wd = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8451 ULONG *flags = wd ? wd->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8452 int z, size = 0, totalsize, count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8453 PRECORDCORE temp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8454 ContainerInfo *ci;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8455 void *blah = NULL;
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 if(!flags || rowcount < 1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8458 return NULL;
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 while(flags[count])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8461 count++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8462
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8463 /* 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
8464 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8465 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8466 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8467 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8468 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8469 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8470 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8471 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8472 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8473 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8474 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8475 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8476 }
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 totalsize = size + sizeof(RECORDCORE);
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 z = 0;
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 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
8483 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8484
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8485 temp = (PRECORDCORE)blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8486
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8487 for(z=0;z<rowcount;z++)
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 temp->cb = totalsize;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8490 temp = temp->preccNextRecord;
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 ci = malloc(sizeof(struct _containerinfo));
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 ci->count = rowcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8496 ci->data = blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8497 ci->handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8498
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8499 return (void *)ci;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8500 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8501
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8502 /* 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
8503 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
8504 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8505 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8506 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8507 int z, currentcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8508 CNRINFO cnr;
1504
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8509 void *dest;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8510
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8511 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8512 return;
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 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
8515 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8516
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8517 currentcount = cnr.cRecords;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8518
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8519 /* 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
8520 for(z=0;z<column;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8521 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8522 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8523 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8524 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8525 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8526 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8527 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8528 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8529 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8530 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8531 size += sizeof(CTIME);
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8534 totalsize = size + sizeof(RECORDCORE);
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 for(z=0;z<(row-currentcount);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8537 temp = temp->preccNextRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8538
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8539 dest = (void *)(((ULONG)temp)+((ULONG)totalsize));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8540
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8541 if(flags[column] & DW_CFA_BITMAPORICON)
1504
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8542 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8543 if(data)
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8544 memcpy(dest, data, sizeof(HPOINTER));
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8545 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8546 memset(dest, 0, sizeof(HPOINTER));
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8547 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8548 else if(flags[column] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8549 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8550 char **newstr = (char **)data, **str = dest;
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 if(*str)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8553 free(*str);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8554
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8555 if(newstr && *newstr)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8556 *str = strdup(*newstr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8557 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8558 *str = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8559 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8560 else if(flags[column] & DW_CFA_ULONG)
1504
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8561 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8562 if(data)
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8563 memcpy(dest, data, sizeof(ULONG));
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8564 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8565 memset(dest, 0, sizeof(ULONG));
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8566 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8567 else if(flags[column] & DW_CFA_DATE)
1504
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8568 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8569 if(data)
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8570 memcpy(dest, data, sizeof(CDATE));
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8571 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8572 memset(dest, 0, sizeof(CDATE));
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8573 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8574 else if(flags[column] & DW_CFA_TIME)
1504
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8575 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8576 if(data)
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8577 memcpy(dest, data, sizeof(CTIME));
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8578 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8579 memset(dest, 0, sizeof(CTIME));
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8580 }
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
8581 }
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
8582
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
8583 /* 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
8584 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
8585 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8586 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8587 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8588 int z, count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8589
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8590 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8591 return;
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 while(flags[count])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8594 count++;
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 /* 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
8597 for(z=0;z<count;z++)
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(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8600 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8601 else if(flags[z] & DW_CFA_STRING)
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 char **str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8604
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8605 totalsize = size + sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8606
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8607 str = (char **)(((ULONG)temp)+((ULONG)totalsize));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8608
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8609 if(*str)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8610 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8611 free(*str);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8612 *str = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8613 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8614 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8615 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8616 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8617 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8618 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8619 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8620 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8621 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8622 }
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
8623 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
8624
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8625 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8626 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8627 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8628 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8629 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8630 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8631 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8632 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8633 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8634 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
8635 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8636 ContainerInfo *ci = (ContainerInfo *)pointer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8637
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8638 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8639 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8640
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8641 _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
8642 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8643
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8644 /*
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8645 * 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
8646 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8647 * 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
8648 * 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
8649 * 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
8650 * 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
8651 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8652 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
8653 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8654 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
8655 int count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8656
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8657 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8658 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8659 if(count == row)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8660 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8661 _dw_container_set_item(handle, pCore, column, 0, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8662 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
8663 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8664 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8665 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
8666 count++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8667 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8668 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8669
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8670 /*
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8671 * 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
8672 * Parameters:
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8673 * 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
8674 * 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
8675 * 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
8676 * 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
8677 */
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8678 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
8679 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8680 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
8681 }
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8682
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8683 /*
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8684 * 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
8685 * Parameters:
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8686 * 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
8687 * 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
8688 * 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
8689 * 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
8690 * 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
8691 */
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
8692 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
8693 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8694 dw_container_change_item(handle, 0, row, (void *)&icon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8695 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
8696 }
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8697
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8698 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8699 * 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
8700 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8701 * 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
8702 * 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
8703 * 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
8704 * 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
8705 * 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
8706 */
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
8707 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
8708 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8709 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
8710 dw_container_set_item(handle, pointer, 1, row, (void *)&filename);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8711 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8712
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8713 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8714 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8715 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8716 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8717 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8718 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8719 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8720 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8721 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8722 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
8723 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8724 dw_container_set_item(handle, pointer, column + 2, row, data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8725 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8726
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8727 /*
508
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8728 * 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
8729 * Parameters:
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8730 * 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
8731 * 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
8732 */
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8733 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
8734 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8735 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8736 ULONG *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8737 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8738
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8739 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8740 return 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 if(flags[column] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8743 rc = DW_CFA_BITMAPORICON;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8744 else if(flags[column] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8745 rc = DW_CFA_STRING;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8746 else if(flags[column] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8747 rc = DW_CFA_ULONG;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8748 else if(flags[column] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8749 rc = DW_CFA_DATE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8750 else if(flags[column] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8751 rc = DW_CFA_TIME;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8752 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8753 rc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8754 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
8755 }
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8756
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8757 /*
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8758 * 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
8759 * Parameters:
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8760 * 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
8761 * 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
8762 */
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8763 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
8764 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8765 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
8766 }
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8767
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8768 /*
1208
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8769 * 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
8770 * Parameters:
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8771 * 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
8772 * 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
8773 * 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
8774 * 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
8775 * 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
8776 */
1291
b99b0b2c2826 Renamed dw_container_set_row_bg() to dw_container_set_stripe().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1290
diff changeset
8777 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
8778 {
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8779 /* 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
8780 }
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8781
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8782 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8783 * 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
8784 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8785 * 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
8786 * 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
8787 * 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
8788 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8789 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
8790 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8791 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8792 column = column; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8793 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
8794 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8795
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8796 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8797 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8798 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8799 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8800 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8801 * title: String title of the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8802 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8803 void API dw_container_set_row_title(void *pointer, int row, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8804 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8805 ContainerInfo *ci = (ContainerInfo *)pointer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8806 PRECORDCORE temp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8807 int z, currentcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8808 CNRINFO cnr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8809
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8810 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8811 return;
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 temp = (PRECORDCORE)ci->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8814
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8815 z = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8816
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8817 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
8818 return;
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 currentcount = cnr.cRecords;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8821
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8822 for(z=0;z<(row-currentcount);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8823 temp = temp->preccNextRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8824
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8825 temp->pszIcon = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8826 temp->pszName = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8827 temp->pszText = (PSZ)title;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8828 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8829
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8830 /*
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
8831 * 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
8832 * 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
8833 * 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
8834 * 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
8835 * 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
8836 */
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
8837 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
8838 {
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
8839 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
8840 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
8841
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
8842 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
8843 {
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
8844 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
8845 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8846 pCore->pszIcon = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8847 pCore->pszName = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8848 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
8849
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
8850 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
8851 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
8852 }
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
8853 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
8854 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
8855 }
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
8856 }
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
8857
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
8858 /* 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
8859 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
8860 {
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
8861 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
8862
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
8863 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
8864 {
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
8865 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
8866 {
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
8867 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
8868 {
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
8869 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
8870 }
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
8871 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
8872 }
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
8873 }
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
8874 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
8875 }
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
8876
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
8877 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8878 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8879 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8880 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8881 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8882 * rowcount: The number of rows to be inserted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8883 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8884 void API dw_container_insert(HWND handle, void *pointer, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8885 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8886 RECORDINSERT recin;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8887 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
8888 PRECORDCORE pCore;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8889
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8890 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8891 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8892
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8893 recin.cb = sizeof(RECORDINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8894 recin.pRecordOrder = (PRECORDCORE)CMA_END;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8895 recin.pRecordParent = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8896 recin.zOrder = CMA_TOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8897 recin.fInvalidateRecord = TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8898 recin.cRecordsInsert = rowcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8899
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8900 _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
8901
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8902 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
8903
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
8904 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
8905 {
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
8906 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
8907
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
8908 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
8909 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
8910 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
8911 _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
8912 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
8913 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8914 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8915
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8916 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8917 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8918 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8919 * 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
8920 * 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
8921 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8922 void API dw_container_clear(HWND handle, int redraw)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8923 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8924 PCNRITEM pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8925 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
8926
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8927 if(hwndEmph == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8928 _clear_emphasis();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8929
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8930 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
8931
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8932 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8933 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8934 if(container)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8935 _dw_container_free_strings(handle, (PRECORDCORE)pCore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8936 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8937 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8938 /* Free icon text */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8939 if(pCore->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8940 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8941 free(pCore->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8942 pCore->rc.pszIcon = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8943 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8944 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8945 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
8946 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8947 _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
8948 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8949
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8950 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8951 * 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
8952 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8953 * 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
8954 * 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
8955 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8956 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
8957 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8958 RECORDCORE *last, **prc = malloc(sizeof(RECORDCORE *) * rowcount);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8959 int current = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8960
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8961 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
8962
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8963 while(last && current < rowcount)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8964 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8965 _dw_container_free_strings(handle, last);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8966 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
8967 current++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8968 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8969
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8970 _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
8971
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8972 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
8973 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8974
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8975 /*
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8976 * 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
8977 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8978 * 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
8979 * 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
8980 * 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
8981 * 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
8982 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8983 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
8984 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8985 rows = rows; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8986 switch(direction)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8987 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8988 case DW_SCROLL_TOP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8989 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
8990 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8991 case DW_SCROLL_BOTTOM:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8992 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(10000000));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8993 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8994 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8995 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8996
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8997 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8998 * Starts a new query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8999 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9000 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9001 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9002 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9003 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9004 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9005 char * API dw_container_query_start(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9006 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9007 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
9008
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9009 if(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9010 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9011 if(flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9012 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9013 while(pCore)
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(pCore->flRecordAttr & flags)
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 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
9018 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9019 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9020 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
9021 }
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9024 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9025 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
9026 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9027 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9028 }
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
9029 return NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9030 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9031
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9032 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9033 * Continues an existing query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9034 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9035 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9036 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9037 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9038 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9039 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9040 char * API dw_container_query_next(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9041 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9042 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
9043
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9044 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
9045
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9046 if(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9047 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9048 if(flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9049 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9050 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9051 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9052 if(pCore->flRecordAttr & flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9053 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9054 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
9055 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9056 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9057
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9058 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
9059 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9060 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9061 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9062 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9063 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
9064 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9065 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9066 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9067 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9068 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9069
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9070 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9071 * 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
9072 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9073 * 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
9074 * 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
9075 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9076 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
9077 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9078 RECTL viewport, item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9079 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
9080 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
9081
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9082 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9083 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9084 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
9085 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9086 QUERYRECORDRECT qrr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9087 int scrollpixels = 0, midway;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9088
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9089 qrr.cb = sizeof(QUERYRECORDRECT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9090 qrr.pRecord = pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9091 qrr.fRightSplitWindow = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9092 qrr.fsExtent = CMA_TEXT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9093
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9094 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
9095 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
9096 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9097
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9098 midway = (viewport.yTop - viewport.yBottom)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9099 scrollpixels = viewport.yTop - (item.yTop + midway);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9100
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9101 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(scrollpixels));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9102 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9103 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9104
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9105 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
9106 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9107 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9108
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9109 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9110 * 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
9111 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9112 * 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
9113 * 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
9114 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9115 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
9116 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9117 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
9118 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
9119
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9120 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9121 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9122 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
9123 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9124 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
9125 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9126 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9127 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
9128 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9129 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9130
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9131 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9132 * 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
9133 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9134 * 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
9135 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9136 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
9137 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9138 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9139 RECTL item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9140 PRECORDCORE pCore = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9141 int max = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9142
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9143 if(blah && !blah->flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9144 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9145
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9146 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
9147 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9148 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9149 QUERYRECORDRECT qrr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9150 int vector;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9151
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9152 qrr.cb = sizeof(QUERYRECORDRECT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9153 qrr.pRecord = pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9154 qrr.fRightSplitWindow = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9155 qrr.fsExtent = CMA_TEXT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9156
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9157 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9158
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9159 vector = item.xRight - item.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9160
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9161 if(vector > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9162 max = vector;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9163
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9164 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
9165 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9166
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9167 if(max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9168 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9169 CNRINFO cnri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9170
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9171 cnri.cb = sizeof(CNRINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9172 cnri.xVertSplitbar = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9173
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9174 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_XVERTSPLITBAR));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9175 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9176 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9177
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9178 /*
487
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9179 * 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
9180 * Parameters:
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9181 * 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
9182 * 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
9183 * 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
9184 */
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
9185 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
9186 {
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9187 /* 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
9188 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
9189 return;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9190
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9191 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
9192 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
9193 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
9194 }
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9195
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9196 /*
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9197 * 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
9198 * Parameters:
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9199 * 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
9200 * 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
9201 */
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
9202 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
9203 {
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9204 /* 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
9205 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
9206 return;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9207
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9208 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
9209 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
9210 }
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9211
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9212 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9213 * Creates a rendering context widget (window) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9214 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9215 * id: An id to be used with dw_window_from_id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9216 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9217 * A handle to the widget or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9218 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9219 HWND API dw_render_new(unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9220 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9221 HWND hwndframe = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9222 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9223 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9224 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9225 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9226 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9227 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9228 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9229 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9230 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9231 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9232 WinSubclassWindow(hwndframe, _RendProc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9233 return hwndframe;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9234 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9235
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9236 /* Sets the current foreground drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9237 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9238 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9239 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9240 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9241 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9242 void API dw_color_foreground_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9243 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9244 _foreground = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9245 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9246
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9247 /* Sets the current background drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9248 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9249 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9250 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9251 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9252 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9253 void API dw_color_background_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9254 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9255 _background = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9256 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9257
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
9258 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
9259 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9260 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9261 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
9262 void *val;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9263
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9264 window = (HWND)dwwait->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9265 val = dw_window_get_data(window, "_dw_val");
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 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9268 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9269 dw_window_destroy(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9270 dw_dialog_dismiss((DWDialog *)data, val);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9271 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
9272 }
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
9273
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
9274 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
9275 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9276 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9277 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
9278 unsigned long val;
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 window = (HWND)dwwait->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9281 val = _dw_color_spin_get(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9282
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9283 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9284 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9285 dw_window_destroy(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9286 dw_dialog_dismiss((DWDialog *)data, (void *)val);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9287 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
9288 }
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
9289
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9290 /* 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
9291 * Parameters:
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9292 * value: current color
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9293 * Returns:
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9294 * The selected color or the current color if cancelled.
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9295 */
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9296 unsigned long API dw_color_choose(unsigned long value)
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9297 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9298 HWND window, hbox, vbox, col, button, text;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9299 DWDialog *dwwait;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9300 HMTX mtx = dw_mutex_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9301
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
9302 window = dw_window_new( HWND_DESKTOP, "Choose Color", FCF_TITLEBAR | FCF_DLGBORDER | FCF_CLOSEBUTTON | FCF_SYSMENU);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9303
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9304 vbox = dw_box_new(DW_VERT, 5);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9305
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9306 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
9307
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9308 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9309
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9310 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
9311 dw_window_set_style(hbox, 0, WS_CLIPCHILDREN);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9312
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9313 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
9314 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
9315
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9316 dw_window_set_data(hbox, "_dw_window", (void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9317 dw_window_set_data(window, "_dw_mutex", (void *)mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9318 dw_window_set_data(window, "_dw_col", (void *)col);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9319 dw_window_set_data(window, "_dw_val", (void *)value);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9320
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9321 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9322 dw_window_set_data(hbox, "_dw_window", (void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9323
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9324 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
9325
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9326 text = dw_text_new("Red:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9327 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
9328 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
9329
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9330 button = dw_spinbutton_new("", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9331 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9332 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
9333 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9334 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
9335
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9336 text = dw_text_new("Green:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9337 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
9338 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
9339
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9340 button = dw_spinbutton_new("", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9341 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9342 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
9343 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9344 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
9345
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9346 text = dw_text_new("Blue:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9347 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
9348 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
9349
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9350 button = dw_spinbutton_new("", 1003L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9351 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9352 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
9353 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9354 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
9355
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9356 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9357
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9358 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
9359 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
9360
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9361 button = dw_button_new("Ok", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9362 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
9363
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9364 dwwait = dw_dialog_new((void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9365
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9366 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
9367
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9368 button = dw_button_new("Cancel", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9369 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
9370
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9371 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
9372 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
9373
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9374 dw_window_set_size(window, 400, 400);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9375
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9376 _dw_col_set(col, value);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9377 _dw_color_spin_set(window, value);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9378
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9379 dw_window_show(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9380
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9381 return (unsigned long)dw_dialog_wait(dwwait);
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9382 }
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9383
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9384 HPS _set_hps(HPS hps)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9385 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9386 LONG alTable[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9387
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9388 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
9389 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
9390
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9391 GpiCreateLogColorTable(hps,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9392 LCOL_RESET,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9393 LCOLF_CONSECRGB,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9394 16,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9395 2,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9396 alTable);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9397 if(_foreground & DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9398 GpiSetColor(hps, 16);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9399 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9400 GpiSetColor(hps, _internal_color(_foreground));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9401 if(_background & DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9402 GpiSetBackColor(hps, 17);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9403 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9404 GpiSetBackColor(hps, _internal_color(_background));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9405 return hps;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9406 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9407
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9408 HPS _set_colors(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9409 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9410 HPS hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9411
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9412 _set_hps(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9413 return hps;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9414 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9415
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9416 /* Draw a point on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9417 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9418 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9419 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9420 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9421 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9422 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9423 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9424 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9425 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9426 int height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9427 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9428
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9429 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9430 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9431 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9432 height = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9433 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9434 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9435 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9436 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9437 height = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9438 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9439 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9440 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9441
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9442 ptl.x = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9443 ptl.y = height - y - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9444
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9445 GpiSetPel(hps, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9446 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9447 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9448 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9449
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9450 /* Draw a line on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9451 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9452 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9453 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9454 * x1: First X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9455 * y1: First Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9456 * x2: Second X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9457 * y2: Second Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9458 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9459 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
9460 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9461 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9462 int height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9463 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9464
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9465 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9466 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9467 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9468 height = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9469 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9470 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9471 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9472 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9473 height = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9474 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9475 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9476 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9477
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9478 ptl[0].x = x1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9479 ptl[0].y = height - y1 - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9480 ptl[1].x = x2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9481 ptl[1].y = height - y2 - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9482
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9483 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9484 GpiLine(hps, &ptl[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9485
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9486 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9487 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9488 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9489
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9490
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
9491 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
9492 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9493 FONTMETRICS fm;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9494 FATTRS fat;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9495 SIZEF sizf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9496
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9497 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
9498
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9499 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
9500
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9501 fat.usRecordLength = sizeof(FATTRS);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9502 fat.lMatch = fm.lMatch;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9503 strcpy(fat.szFacename, fm.szFacename);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9504
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9505 GpiCreateLogFont(hpsDst, 0, 1L, &fat);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9506 GpiSetCharSet(hpsDst, 1L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9507
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9508 sizf.cx = MAKEFIXED(fm.lEmInc,0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9509 sizf.cy = MAKEFIXED(fm.lMaxBaselineExt,0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9510 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
9511 }
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
9512
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9513 /* Draw text on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9514 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9515 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9516 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9517 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9518 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9519 * text: Text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9520 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9521 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
9522 {
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
9523 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
9524 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
9525 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
9526 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
9527 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
9528
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9529 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
9530 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9531 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
9532 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
9533 _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
9534 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9535 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
9536 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9537 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
9538
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9539 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
9540 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
9541 _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
9542 _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
9543 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
9544 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9545 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
9546 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
9547
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9548 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
9549 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9550 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
9551 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
9552 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9553
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9554 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
9555
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9556 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
9557 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
9558 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
9559 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
9560
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9561 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
9562 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
9563 else
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9564 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
9565
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9566 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
9567 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9568 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9569
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
9570 /* 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
9571 * 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
9572 * 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
9573 * 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
9574 * 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
9575 * 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
9576 * 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
9577 */
514
08d770271709 More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 513
diff changeset
9578 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
9579 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9580 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9581 POINTL aptl[TXTBOX_COUNT];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9582
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9583 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9584 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9585 hps = _set_colors(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9586 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9587 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9588 {
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
9589 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
9590
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9591 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9592 _CopyFontSettings(pixmaphps, hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9593 WinReleasePS(pixmaphps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9594 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9595 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9596 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9597
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9598 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
9599
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9600 if(width)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9601 *width = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9602
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9603 if(height)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9604 *height = aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9605
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9606 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9607 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
9608 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9609
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9610 /* 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
9611 * Parameters:
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9612 * handle: Handle to the window.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9613 * 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
9614 * 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
9615 * x: X coordinate.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9616 * y: Y coordinate.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9617 * width: Width of rectangle.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9618 * height: Height of rectangle.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9619 */
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
9620 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
9621 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9622 HPS hps;
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9623 int thisheight;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9624 POINTL *pptl;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9625 POINTL start;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9626 int i;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9627
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9628 if(handle)
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9629 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9630 hps = _set_colors(handle);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9631 thisheight = _get_height(handle);
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9632 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9633 else if(pixmap)
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9634 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9635 hps = _set_hps(pixmap->hps);
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9636 thisheight = pixmap->height;
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9637 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9638 else
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9639 return;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9640 if ( npoints == 0 )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9641 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9642 pptl = (POINTL *)malloc(sizeof(POINTL)*npoints);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9643 if ( pptl == NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9644 return;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9645 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9646 * 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
9647 */
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
9648 if ( flags & DW_DRAW_FILL )
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9649 GpiBeginArea( hps, 0L );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9650 if ( npoints )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9651 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9652 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9653 * 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
9654 */
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9655 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
9656 start.y = thisheight - y[0] - 1;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9657 GpiMove( hps, &start );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9658 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9659 * 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
9660 */
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9661 for ( i = 1; i < npoints; i++ )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9662 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9663 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
9664 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
9665 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9666 GpiPolyLine( hps, npoints-1, pptl );
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9667
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
9668 if ( flags & DW_DRAW_FILL )
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9669 GpiEndArea( hps );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9670 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9671 if ( !pixmap )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9672 WinReleasePS(hps);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9673 free( pptl );
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9674 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9675
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9676 /* Draw a rectangle on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9677 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9678 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9679 * 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
9680 * flags: DW_DRAW_FILL (1) to fill the box or DW_DRAW_DEFAULT (0).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9681 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9682 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9683 * width: Width of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9684 * height: Height of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9685 */
1276
1cdc18d760e0 Fixed improper fill method in dw_draw_rect() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1275
diff changeset
9686 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
9687 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9688 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9689 int thisheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9690 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9691
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9692 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9693 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9694 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9695 thisheight = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9696 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9697 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9698 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9699 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9700 thisheight = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9701 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9702 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9703 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9704
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9705 ptl[0].x = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9706 ptl[0].y = thisheight - y - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9707 ptl[1].x = x + width - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9708 ptl[1].y = thisheight - y - height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9709
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9710 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
9711 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
9712
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9713 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9714 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9715 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9716
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
9717 /* 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
9718 #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
9719 #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
9720 #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
9721
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9722 /* 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
9723 * Parameters:
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9724 * 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
9725 * 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
9726 * 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
9727 * 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
9728 * 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
9729 * 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
9730 * 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
9731 * 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
9732 * 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
9733 * 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
9734 */
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9735 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
9736 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9737 HPS hps;
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9738 int thisheight;
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9739 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
9740 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
9741 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
9742
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9743 if(handle)
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9744 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9745 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
9746 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
9747 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9748 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
9749 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9750 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
9751 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
9752 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9753 else
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9754 return;
1274
885b55c0d7d7 Implemented DW_DRAW_FULL and DW_DRAW_FILL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1262
diff changeset
9755
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
9756 /* 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
9757 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
9758 {
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
9759 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
9760 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
9761 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
9762 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
9763 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
9764 /* 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
9765 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
9766 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
9767 }
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
9768 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
9769 {
1290
d2c4deea6bf6 Simplified fill for ellipses and circles on OS/2 using DRO_OUTLINEFILL.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1286
diff changeset
9770 /* 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
9771 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
9772 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
9773
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
9774 /* 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
9775 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
9776 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
9777 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
9778 /* 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
9779 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
9780 /* 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
9781 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
9782 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
9783 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
9784 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
9785 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
9786 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
9787 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
9788 /* 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
9789 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
9790 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
9791 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
9792 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
9793 /* 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
9794 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
9795 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
9796 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
9797 }
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9798
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9799 if(!pixmap)
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9800 WinReleasePS(hps);
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9801 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9802
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9803 /* Call this after drawing to the screen to make sure
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9804 * anything you have drawn is visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9805 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9806 void API dw_flush(void)
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9811 * Creates a pixmap with given parameters.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9812 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9813 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9814 * width: Width of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9815 * height: Height of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9816 * depth: Color depth of the pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9817 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9818 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9819 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9820 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
9821 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9822 BITMAPINFOHEADER bmih;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9823 SIZEL sizl = { 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9824 HPIXMAP pixmap;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9825 HDC hdc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9826 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9827 ULONG ulFlags;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9828 LONG cPlanes, cBitCount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9829
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9830 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9831 return NULL;
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 hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9834
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9835 hdc = GpiQueryDevice(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9836 ulFlags = GpiQueryPS(hps, &sizl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9837
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9838 pixmap->handle = handle;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9839 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
9840 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
9841
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9842 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9843 if (!depth)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9844 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9845 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9846 depth = cBitCount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9847 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9848
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9849 memset(&bmih, 0, sizeof(BITMAPINFOHEADER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9850 bmih.cbFix = sizeof(BITMAPINFOHEADER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9851 bmih.cx = (SHORT)width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9852 bmih.cy = (SHORT)height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9853 bmih.cPlanes = (SHORT)cPlanes;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9854 bmih.cBitCount = (SHORT)depth;
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 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
9857 pixmap->transcolor = DW_CLR_DEFAULT;
643
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 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
9860
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9861 GpiSetBitmap(pixmap->hps, pixmap->hbm);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9862
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9863 if (depth>8)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9864 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
9865
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9866 WinReleasePS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9867
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9868 return pixmap;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9869 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9870
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9871 /*
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9872 * Creates a pixmap from a file.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9873 * Parameters:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9874 * 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
9875 * 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
9876 * DW pick the appropriate file extension.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9877 * (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
9878 * Returns:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9879 * 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
9880 */
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9881 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
9882 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9883 HPIXMAP pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9884 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9885
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9886 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
9887 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9888
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9889 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9890
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9891 /* 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
9892 if ( access(file, 04) != 0 )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9893 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9894 /* Try with .bmp extention */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9895 strcat(file, ".bmp");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9896 if ( access(file, 04) != 0 )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9897 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9898 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9899 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9900 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9901 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9902
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9903 /* 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
9904 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
9905 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9906 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9907 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9908 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9909
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9910 /* Success fill in other values */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9911 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
9912 pixmap->transcolor = DW_CLR_DEFAULT;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9913
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9914 return pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9915 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9916
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9917 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9918 * Creates a pixmap from memory.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9919 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9920 * 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
9921 * data: Source of the image data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9922 * (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
9923 * le: length of data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9924 * Returns:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9925 * 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
9926 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9927 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
9928 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9929 HPIXMAP pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9930 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9931 FILE *fp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9932
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9933 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
9934 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9935
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9936 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9937 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9938 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9939 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9940 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9941 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9942 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9943 fclose( fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9944 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
9945 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9946 /* 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
9947 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
9948 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9949 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9950 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9951 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9952 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9953 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
9954 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9955 /* con't use ICO ? */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9956 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9957 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9958 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9959 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9960 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9961 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9962 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9963 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9964 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9965 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9966 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9967
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9968 /* Success fill in other values */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9969 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
9970 pixmap->transcolor = DW_CLR_DEFAULT;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9971
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9972 return pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9973 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9974
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9975 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9976 * 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
9977 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9978 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
9979 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9980 if ( pixmap )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9981 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9982 pixmap->transcolor = _internal_color(color);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9983 }
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9984 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9985
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9986 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9987 * Creates a pixmap from internal resource graphic specified by id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9988 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9989 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9990 * id: Resource ID associated with requested pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9991 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9992 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9993 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9994 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9995 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9996 BITMAPINFOHEADER bmih;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9997 SIZEL sizl = { 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9998 HPIXMAP pixmap;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9999 HDC hdc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10000 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10001 ULONG ulFlags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10002
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10003 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10004 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10005
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10006 hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10007
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10008 hdc = GpiQueryDevice(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10009 ulFlags = GpiQueryPS(hps, &sizl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10010
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10011 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
10012 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
10013
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10014 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10015
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10016 GpiQueryBitmapParameters(pixmap->hbm, &bmih);
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 GpiSetBitmap(pixmap->hps, pixmap->hbm);
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 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
10021 pixmap->transcolor = DW_CLR_DEFAULT;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10022
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10023 WinReleasePS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10024
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10025 return pixmap;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10026 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10027
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10028 /*
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10029 * 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
10030 * 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
10031 * 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
10032 * Parameters:
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10033 * 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
10034 * 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
10035 * 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
10036 * Returns:
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10037 * 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
10038 */
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10039 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
10040 {
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10041 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
10042 {
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
10043 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
10044 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
10045 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
10046 return DW_ERROR_NONE;
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10047 }
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10048 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
10049 }
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10050
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10051 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10052 * Destroys an allocated pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10053 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10054 * pixmap: Handle to a pixmap returned by
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10055 * dw_pixmap_new..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10056 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10057 void API dw_pixmap_destroy(HPIXMAP pixmap)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10058 {
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
10059 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
10060 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
10061 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
10062 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
10063 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
10064 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
10065 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
10066 free(pixmap);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10067 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10068
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10069 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10070 * Copies from one item to another.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10071 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10072 * dest: Destination window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10073 * destp: Destination pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10074 * xdest: X coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10075 * ydest: Y coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10076 * width: Width of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10077 * height: Height of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10078 * src: Source window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10079 * srcp: Source pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10080 * xsrc: X coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10081 * ysrc: Y coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10082 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10083 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
10084 {
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10085 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
10086 }
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10087
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10088 /*
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10089 * 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
10090 * Parameters:
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10091 * 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
10092 * 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
10093 * 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
10094 * 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
10095 * 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
10096 * 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
10097 * 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
10098 * 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
10099 * 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
10100 * 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
10101 * 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
10102 * 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
10103 * Returns:
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10104 * 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
10105 */
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10106 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
10107 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10108 HPS hpsdest;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10109 HPS hpssrc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10110 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
10111 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
10112 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
10113
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
10114 /* 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
10115 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
10116 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
10117
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10118 if(dest)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10119 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10120 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
10121 dheight = _get_height(dest);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10122 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10123 else if(destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10124 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10125 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
10126 dheight = destp->height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10127 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10128 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
10129 return DW_ERROR_GENERAL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10130
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10131 if(src)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10132 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10133 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
10134 sheight = _get_height(src);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10135 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10136 else if(srcp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10137 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10138 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
10139 sheight = srcp->height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10140 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10141 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10142 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10143 if(!destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10144 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
10145 return DW_ERROR_GENERAL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10146 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10147
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10148 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
10149 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
10150 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
10151 ptl[1].y = dheight - ydest;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10152 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
10153 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
10154 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
10155 {
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10156 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
10157 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
10158 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
10159 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10160
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
10161 /* 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
10162 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
10163 {
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
10164 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
10165 /* 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
10166 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
10167 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
10168 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
10169 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
10170 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
10171 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
10172 }
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
10173 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
10174 {
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
10175 /* 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
10176 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
10177 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10178
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10179 if(!destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10180 WinReleasePS(hpsdest);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10181 if(!srcp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10182 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
10183 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10184 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10185
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
10186 /* 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
10187 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
10188 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10189 int *info = (int *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10190
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10191 if(data)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10192 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10193 DosBeep(info[0], info[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10194 free(data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10195 }
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
10196 }
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
10197
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10198 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10199 * Emits a beep.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10200 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10201 * freq: Frequency.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10202 * dur: Duration.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10203 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10204 void API dw_beep(int freq, int dur)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10205 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10206 int *info = malloc(sizeof(int) * 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10207
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10208 if(info)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10209 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10210 info[0] = freq;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10211 info[1] = dur;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10212
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10213 _beginthread(_beepthread, NULL, 100, (void *)info);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10214 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10215 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10216
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10217 /* Open a shared library and return a handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10218 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10219 * name: Base name of the shared library.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10220 * handle: Pointer to a module handle,
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10221 * will be filled in with the handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10222 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10223 int API dw_module_load(char *name, HMOD *handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10224 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10225 char objnamebuf[300] = "";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10226
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10227 return DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)name, handle);
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10228 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10229
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10230 /* Queries the address of a symbol within open handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10231 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10232 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10233 * name: Name of the symbol you want the address of.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10234 * func: A pointer to a function pointer, to obtain
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10235 * the address.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10236 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10237 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
10238 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10239 return DosQueryProcAddr(handle, 0, (PSZ)name, (PFN*)func);
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10240 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10241
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10242 /* Frees the shared library previously opened.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10243 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10244 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10245 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10246 int API dw_module_close(HMOD handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10247 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10248 DosFreeModule(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10249 return 0;
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10250 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10251
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10252 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10253 * Returns the handle to an unnamed mutex semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10254 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10255 HMTX API dw_mutex_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10256 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10257 HMTX mutex;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10258
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10259 DosCreateMutexSem(NULL, &mutex, 0, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10260 return mutex;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10261 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10262
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10263 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10264 * Closes a semaphore created by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10265 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10266 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10267 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10268 void API dw_mutex_close(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10269 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10270 DosCloseMutexSem(mutex);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10271 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10272
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10273 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10274 * 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
10275 * 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
10276 * while blocking.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10277 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10278 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10279 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10280 void API dw_mutex_lock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10281 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10282 if(_dwtid == dw_thread_id())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10283 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10284 int rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10285
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10286 while(rc == ERROR_TIMEOUT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10287 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10288 dw_main_sleep(10);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10289 rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10290 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10291 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
10292 else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10293 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10294 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10295
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10296 /*
1158
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10297 * 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
10298 * Parameters:
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10299 * 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
10300 * Returns:
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10301 * 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
10302 */
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10303 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
10304 {
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10305 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
10306 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
10307 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
10308 }
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10309
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10310 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10311 * Reliquishes the access to the semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10312 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10313 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10314 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10315 void API dw_mutex_unlock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10316 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10317 DosReleaseMutexSem(mutex);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10318 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10319
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10320 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10321 * Returns the handle to an unnamed event semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10322 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10323 HEV API dw_event_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10324 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10325 HEV blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10326
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10327 if(DosCreateEventSem (NULL, &blah, 0L, FALSE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10328 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10329
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10330 return blah;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10331 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10332
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10333 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10334 * Resets a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10335 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10336 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10337 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10338 int API dw_event_reset(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10339 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10340 ULONG count;
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 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
10343 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
10344 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10345 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10346
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10347 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10348 * Posts a semaphore created by dw_event_new(). Causing all threads
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10349 * waiting on this event in dw_event_wait to continue.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10350 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10351 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10352 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10353 int API dw_event_post(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10354 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10355 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
10356 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
10357 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10358 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10359
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10360
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10361 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10362 * Waits on a semaphore created by dw_event_new(), until the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10363 * event gets posted or until the timeout expires.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10364 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10365 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10366 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10367 int API dw_event_wait(HEV eve, unsigned long timeout)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10368 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10369 int rc = DosWaitEventSem(eve, timeout);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10370 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
10371 return DW_ERROR_NONE;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10372 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
10373 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
10374 return DW_ERROR_GENERAL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10375 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10376
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10377 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10378 * Closes a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10379 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10380 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10381 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10382 int API dw_event_close(HEV *eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10383 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10384 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
10385 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
10386 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10387 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10388
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
10389 /* 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
10390 * 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
10391 * 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
10392 * 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
10393 * 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
10394 * 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
10395 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10396 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
10397 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10398 char *semname = malloc(strlen(name)+8);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10399 HEV ev = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10400
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10401 if(!semname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10402 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10403
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10404 strcpy(semname, "\\sem32\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10405 strcat(semname, name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10406
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10407 DosCreateEventSem((PSZ)semname, &ev, 0L, FALSE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10408
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10409 free(semname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10410 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
10411 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10412
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10413 /* 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
10414 * 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
10415 * 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
10416 * 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
10417 * 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
10418 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10419 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
10420 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10421 char *semname = malloc(strlen(name)+8);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10422 HEV ev;
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 if(!semname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10425 return 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 strcpy(semname, "\\sem32\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10428 strcat(semname, name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10429
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10430 DosOpenEventSem((PSZ)semname, &ev);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10431
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10432 free(semname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10433 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
10434 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10435
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10436 /* 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
10437 * 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
10438 * 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
10439 * 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
10440 * 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
10441 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10442 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
10443 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10444 ULONG count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10445
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10446 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
10447 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10448
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10449 /* 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
10450 * 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
10451 * 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
10452 * 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
10453 * 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
10454 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10455 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
10456 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10457 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
10458 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10459
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10460
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10461 /* 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
10462 * 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
10463 * 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
10464 * 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
10465 * 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
10466 * 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
10467 * 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
10468 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10469 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
10470 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10471 int rc;
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 rc = DosWaitEventSem(eve, timeout);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10474 switch (rc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10475 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10476 case ERROR_INVALID_HANDLE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10477 rc = DW_ERROR_NON_INIT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10478 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10479 case ERROR_NOT_ENOUGH_MEMORY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10480 rc = DW_ERROR_NO_MEM;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10481 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10482 case ERROR_INTERRUPT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10483 rc = DW_ERROR_INTERRUPT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10484 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10485 case ERROR_TIMEOUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10486 rc = DW_ERROR_TIMEOUT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10487 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10490 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
10491 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10492
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10493 /* 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
10494 * 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
10495 * 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
10496 * 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
10497 * 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
10498 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10499 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
10500 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10501 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10502
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10503 rc = DosCloseEventSem(eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10504 switch (rc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10505 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10506 case ERROR_INVALID_HANDLE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10507 rc = DW_ERROR_NON_INIT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10508 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10509
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10510 case ERROR_SEM_BUSY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10511 rc = DW_ERROR_INTERRUPT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10512 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10515 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
10516 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10517
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10518 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10519 * 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
10520 * 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
10521 * 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
10522 * 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
10523 * 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
10524 * 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
10525 */
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
10526 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
10527 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10528 char namebuf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10529
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10530 sprintf(namebuf, "\\sharemem\\%s", name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10531
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10532 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
10533 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10534
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10535 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
10536 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10537
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10538 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10539 * 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
10540 * 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
10541 * 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
10542 * 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
10543 * 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
10544 */
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
10545 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
10546 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10547 char namebuf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10548
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10549 size = size;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10550 sprintf(namebuf, "\\sharemem\\%s", name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10551
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10552 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
10553 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10554
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10555 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
10556 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10557
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10558 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10559 * 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
10560 * 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
10561 * 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
10562 * 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
10563 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10564 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
10565 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10566 handle = handle;
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 if(DosFreeMem(ptr) != NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10569 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10570 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
10571 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10572
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10573 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10574 * Encapsulate the message queues on OS/2.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10575 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10576 void _dwthreadstart(void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10577 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10578 HAB thishab = WinInitialize(0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10579 HMQ thishmq = WinCreateMsgQueue(dwhab, 0);
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
10580 void (API_FUNC threadfunc)(void *) = NULL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10581 void **tmp = (void **)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10582
1407
2f10480d2c8a More Watcom build fixes from abwillis and a change to allow VAC30 to work again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1405
diff changeset
10583 threadfunc = (void (API_FUNC)(void *))tmp[0];
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10584 threadfunc(tmp[1]);
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 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10587
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10588 WinDestroyMsgQueue(thishmq);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10589 WinTerminate(thishab);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10590 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10591
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10592 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10593 * Creates a new thread with a starting point of func.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10594 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10595 * func: Function which will be run in the new thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10596 * data: Parameter(s) passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10597 * stack: Stack size of new thread (OS/2 and Windows only).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10598 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10599 DWTID API dw_thread_new(void *func, void *data, int stack)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10600 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10601 void **tmp = malloc(sizeof(void *) * 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10602
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10603 tmp[0] = func;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10604 tmp[1] = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10605
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10606 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10607 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10608
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10609 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10610 * Ends execution of current thread immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10611 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10612 void API dw_thread_end(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10613 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10614 _endthread();
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10615 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10616
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10617 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10618 * Returns the current thread's ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10619 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10620 DWTID API dw_thread_id(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10621 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10622 return (DWTID)_threadid;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10623 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10624
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10625 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10626 * Cleanly terminates a DW session, should be signal handler safe.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10627 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10628 * exitcode: Exit code reported to the operating system.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10629 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10630 void API dw_exit(int exitcode)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10631 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10632 /* Destroy the menu message window */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10633 dw_window_destroy(hwndApp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10634
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10635 /* 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
10636 * try to free memory that could possibly be
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10637 * free()'d by the runtime already.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10638 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10639 Root = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10640
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10641 /* Destroy the main message queue and anchor block */
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10642 WinDestroyMsgQueue(dwhmq);
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10643 WinTerminate(dwhab);
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10644
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10645 /* Free any in use modules */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10646 DosFreeModule(wpconfig);
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10647 DosFreeModule(pmprintf);
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10648 DosFreeModule(pmmerge);
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10649
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10650 /* And finally exit */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10651 exit(exitcode);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10652 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10653
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10654 /*
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
10655 * 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
10656 * 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
10657 * 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
10658 * 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
10659 * 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
10660 * 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
10661 * 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
10662 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10663 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
10664 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10665 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
10666 (PSZ)SplitbarClassName,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10667 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10668 WS_VISIBLE | WS_CLIPCHILDREN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10669 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10670 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10671 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10672 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10673 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10674 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10675 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10676 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10677 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
10678 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
10679
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10680 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
10681 WinSetParent(tmpbox, tmp, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10682 dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10683
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10684 tmpbox = dw_box_new(DW_VERT, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10685 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
10686 WinSetParent(tmpbox, tmp, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10687 *percent = 50.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10688 dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10689 dw_window_set_data(tmp, "_dw_percent", (void *)percent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10690 dw_window_set_data(tmp, "_dw_type", (void *)type);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10691 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10692 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
10693 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10694
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10695 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10696 * 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
10697 * 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
10698 * 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
10699 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10700 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
10701 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10702 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
10703 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
10704 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
10705
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10706 if(mypercent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10707 *mypercent = percent;
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 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
10710
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10711 _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
10712 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10713
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10714 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10715 * 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
10716 * 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
10717 * 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
10718 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10719 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
10720 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10721 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
10722
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10723 if(percent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10724 return *percent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10725 return 0.0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10726 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10727
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10728 /* The following two functions graciously contributed by Peter Nielsen. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10729 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10730 char* pchStart = pchBuffer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10731 char* pchEnd = pchStart + ulSize - 2;
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 while (pchEnd >= pchStart)
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 if ((pchEnd[0] == '#') && (pchEnd[1] == '@'))
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 *pchEnd-- = '\0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10738 while (pchEnd >= pchStart)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10739 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10740 if ((pchEnd[0] == '@') && (pchEnd[1] == '#'))
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 ULONG ulMajor = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10743 ULONG ulMinor = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10744
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10745 char* pch = pchEnd + 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10746 while (!isdigit ((int)*pch) && *pch)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10747 pch++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10748
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10749 while (isdigit ((int)*pch))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10750 ulMajor = ulMajor * 10 + *pch++ - '0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10751
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10752 if (*pch == '.')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10753 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10754 while (isdigit ((int)*++pch))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10755 ulMinor = ulMinor * 10 + *pch - '0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10756 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10757 return ((ulMajor << 16) | ulMinor);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10758 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10759 pchEnd--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10760 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10761 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10762 pchEnd--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10763 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10764 return (0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10765 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10766
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10767 ULONG _GetSystemBuildLevel(void) {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10768 /* 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
10769 * 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
10770 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10771 ULONG ulBootDrive = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10772 ULONG ulBuild = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10773 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
10774 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10775 char achFileName[11] = "C:\\OS2KRNL";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10776 HFILE hfile;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10777 ULONG ulResult;
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
10778
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
10779 achFileName[0] = (char)('A'+ulBootDrive-1);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
10780
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10781 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
10782 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10783 ULONG ulFileSize = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10784 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10785 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10786 const ULONG ulFirstTry = min (256, ulFileSize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10787 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
10788 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10789 char *pchBuffer = malloc(ulFirstTry);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10790 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR)
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 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10793 if (ulBuild == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10794 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10795 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10796 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10797 free(pchBuffer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10798 pchBuffer = malloc(ulFileSize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10799
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10800 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10801 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10802 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10803 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10804 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10805 free(pchBuffer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10806 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10807 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10808 DosClose (hfile);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10809 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10810 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10811 return (ulBuild);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10812 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10813
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
10814 /*
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
10815 * 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
10816 * 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
10817 * 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
10818 * 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
10819 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10820 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
10821 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10822 Box *thisbox = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10823 HWND box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10824
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10825 box = WinWindowFromID(window, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10826 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10827 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10828
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10829 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10830 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
10831 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10832
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10833 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
10834 * 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
10835 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
10836 * 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
10837 * 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
10838 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10839 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
10840 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10841 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10842
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10843 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10844 blah->clickdefault = next;
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
10845 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
10846
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
10847 /*
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10848 * 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
10849 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10850 * None.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10851 * Returns:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10852 * 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
10853 * be converted to text.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10854 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10855 char *dw_clipboard_get_text()
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10856 {
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
10857 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
10858 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
10859 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
10860
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10861 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
10862
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10863 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
10864 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
10865 {
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10866 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
10867 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
10868 }
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10869 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
10870 return retbuf;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10871 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10872
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10873 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10874 * 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
10875 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10876 * Text.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10877 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10878 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
10879 {
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
10880 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
10881 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
10882
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10883 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
10884 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
10885
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10886 /* 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
10887
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10888 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
10889 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
10890
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10891 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
10892 {
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10893 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
10894
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10895 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
10896 }
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10897
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10898 WinCloseClipbrd(dwhab); /* Close clipboard */
822
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
10899 return;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10900 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10901
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10902 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10903 * Returns some information about the current operating environment.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10904 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10905 * env: Pointer to a DWEnv struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10906 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10907 void API dw_environment_query(DWEnv *env)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10908 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10909 ULONG Build;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10910
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10911 if(!env)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10912 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10913
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10914 /* The default is OS/2 2.0 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10915 strcpy(env->osName,"OS/2");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10916 env->MajorVersion = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10917 env->MinorVersion = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10918
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10919 Build = _GetSystemBuildLevel();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10920 env->MinorBuild = Build & 0xFFFF;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10921 env->MajorBuild = Build >> 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10922
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10923 if (aulBuffer[0] == 20)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10924 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10925 int i = (unsigned int)aulBuffer[1];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10926 if (i > 20)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10927 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10928 strcpy(env->osName,"Warp");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10929 env->MajorVersion = (int)i/10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10930 env->MinorVersion = i-(((int)i/10)*10);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10931 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10932 else if (i == 10)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10933 env->MinorVersion = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10934 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10935 strcpy(env->buildDate, __DATE__);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10936 strcpy(env->buildTime, __TIME__);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10937 env->DWMajorVersion = DW_MAJOR_VERSION;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10938 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
10939 #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
10940 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
10941 #else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10942 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
10943 #endif
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10944 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10945
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10946 /* 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
10947 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
10948 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10949 FILEFINDBUF3 ffbuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10950 HTREEITEM item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10951 ULONG count = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10952 HDIR hdir = HDIR_CREATE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10953
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10954 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
10955 &ffbuf, sizeof(FILEFINDBUF3), &count, FIL_STANDARD) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10956 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10957 while(DosFindNext(hdir, &ffbuf, sizeof(FILEFINDBUF3), &count) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10958 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10959 if(strcmp(ffbuf.achName, ".") && strcmp(ffbuf.achName, ".."))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10960 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10961 int len = strlen(path);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10962 char *folder = malloc(len + ffbuf.cchName + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10963 HTREEITEM tempitem;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10964
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10965 strcpy(folder, path);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10966 strcpy(&folder[len-1], ffbuf.achName);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10967
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10968 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
10969 tempitem = dw_tree_insert(tree, "", 0, item, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10970 dw_tree_item_set_data(tree, item, (void *)tempitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10971 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10972 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10973 DosFindClose(hdir);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10974 }
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10975 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10976
906
71b0e132d9df Added missing API to _popuplate_tree_thread() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 904
diff changeset
10977 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
10978 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10979 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
10980 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
10981 int drive;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10982 HTREEITEM items[26];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10983 FSINFO volinfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10984
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10985 DosError(FERR_DISABLEHARDERR);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10986
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10987 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10988 for(drive=0;drive<26;drive++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10989 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10990 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
10991 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10992 char folder[5] = "C:\\", name[9] = "Drive C:";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10993 HTREEITEM tempitem;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10994
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10995 folder[0] = name[6] = 'A' + drive;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10996
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10997 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
10998 tempitem = dw_tree_insert(tree, "", 0, items[drive], 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10999 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
11000 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11001 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11002 items[drive] = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11003 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11004 dw_mutex_unlock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11005
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11006 DosError(FERR_ENABLEHARDERR);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11007 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11008
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11009 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
11010 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11011 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11012 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
11013 void *treedata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11014
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11015 window = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11016 if(!dwwait)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11017 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11018
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11019 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11020 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
11021 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11022 dw_window_destroy((HWND)dwwait->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11023 dw_dialog_dismiss((DWDialog *)data, treedata);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11024 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11025 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11026
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11027 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
11028 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11029 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11030 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
11031
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11032 window = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11033 if(!dwwait)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11034 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11035
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11036 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11037 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11038 dw_window_destroy((HWND)dwwait->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11039 dw_dialog_dismiss((DWDialog *)data, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11040 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11041 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11042
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
11043 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
11044 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11045 char *folder=strdup("");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11046 HTREEITEM parent = item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11047
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11048 while(parent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11049 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11050 char *temp, *text = dw_tree_get_title(tree, parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11051
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11052 if(text)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11053 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11054 if(strncmp(text, "Drive ", 6) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11055 text = &text[6];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11056
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11057 temp = malloc(strlen(text) + strlen(folder) + 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11058 strcpy(temp, text);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11059 strcat(temp, "\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11060 strcat(temp, folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11061 free(folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11062 folder = temp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11063 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11064 parent = dw_tree_get_parent(tree, parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11065 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11066 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
11067 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
11068
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11069 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
11070 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11071 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11072 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
11073
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11074 text = text; itemdata = itemdata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11075 if(treedata)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11076 free(treedata);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11077
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11078 treedata = _tree_folder(window, item);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11079 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
11080
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11081 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11082 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11083
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
11084 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
11085 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11086 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
11087
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11088 data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11089 if(tempitem)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11090 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11091 char *folder = _tree_folder(window, item);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11092
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11093 dw_tree_item_set_data(window, item, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11094 dw_tree_item_delete(window, tempitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11095
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11096 if(*folder)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11097 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11098 strcat(folder, "*");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11099 _populate_directory(window, item, folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11100 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11101 free(folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11102 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11103
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11104 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
11105 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
11106
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11107 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11108 * Opens a file dialog and queries user selection.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11109 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11110 * title: Title bar text for dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11111 * defpath: The default path of the open dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11112 * ext: Default file extention.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11113 * flags: DW_FILE_OPEN or DW_FILE_SAVE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11114 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11115 * NULL on error. A malloced buffer containing
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11116 * the file path on success.
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
11117 *
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11118 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11119 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11120 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11121 if(flags == DW_DIRECTORY_OPEN)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11122 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11123 HWND window, hbox, vbox, tree, button;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11124 DWDialog *dwwait;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11125 HMTX mtx = dw_mutex_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11126
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
11127 window = dw_window_new( HWND_DESKTOP, title, FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11128
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11129 vbox = dw_box_new(DW_VERT, 5);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11130
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11131 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
11132
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11133 tree = dw_tree_new(60);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11134
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11135 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
11136 dw_window_set_data(window, "_dw_mutex", (void *)mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11137 dw_window_set_data(window, "_dw_tree", (void *)tree);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11138
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11139 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11140
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11141 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
11142
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11143 dwwait = dw_dialog_new((void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11144
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11145 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
11146 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
11147
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11148 button = dw_button_new("Ok", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11149 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
11150 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
11151
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11152 button = dw_button_new("Cancel", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11153 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
11154 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
11155 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
11156
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11157 dw_window_set_size(window, 225, 300);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11158 dw_window_show(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11159
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11160 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
11161 return (char *)dw_dialog_wait(dwwait);
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11164 {
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11165 FILEDLG fild = { 0 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11166 HWND hwndFile;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11167 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
11168 struct stat buf;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11169
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11170 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
11171 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11172 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
11173 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
11174 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11175
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11176 len = strlen(fild.szFullFile);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11177
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11178 /* If we have a defpath */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11179 if(len)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11180 {
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11181 /* 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
11182 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
11183 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11184 /* 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
11185 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
11186 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11187 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
11188 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
11189 /* 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
11190 len = 0;
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11191 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11192 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11193 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11194
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11195 /* 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
11196 if(!len)
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11197 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11198 /* 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
11199 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
11200
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11201 /* 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
11202 if(ext)
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11203 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11204 /* 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
11205 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
11206 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
11207 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11208 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11209
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11210 /* Setup the structure */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11211 fild.cbSize = sizeof(FILEDLG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11212 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
11213 fild.pszTitle = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11214 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
11215 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc;
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 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11218 if(hwndFile)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11219 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11220 switch(fild.lReturn)
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 case DID_OK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11223 return strdup(fild.szFullFile);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11224 case DID_CANCEL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11225 return NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11228 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11229 return NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11230 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11231
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11232 /* 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
11233 int _SetPath(char *path)
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11234 {
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11235 #ifndef __WATCOMC__
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11236 if(strlen(path) > 2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11237 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11238 if(path[1] == ':')
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 char drive = toupper(path[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11241 _chdrive((drive - 'A')+1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11242 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11243 }
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11244 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11245 return chdir(path);
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11246 }
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11247
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11248 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11249 * Execute and external program in a seperate session.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11250 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11251 * program: Program name with optional path.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11252 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11253 * params: An array of pointers to string arguements.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11254 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11255 * -1 on error.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11256 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11257 int API dw_exec(char *program, int type, char **params)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11258 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11259 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
11260 return spawnvp(P_NOWAIT, program, (char * const *)params);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11261 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11262
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11263 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11264 * Loads a web browser pointed at the given URL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11265 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11266 * url: Uniform resource locator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11267 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11268 int API dw_browse(char *url)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11269 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11270 char *execargs[3], browser[1024], *olddir, *newurl = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11271 int len, ret;
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 olddir = _getcwd(NULL, 1024);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11274
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11275 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
11276 (PSZ)"DefaultWorkingDir", NULL, (PSZ)browser, 1024);
643
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 if(browser[0])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11279 _SetPath(browser);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11280
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11281 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
11282 (PSZ)"DefaultBrowserExe", NULL, (PSZ)browser, 1024);
643
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 len = strlen(browser) - strlen("explore.exe");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11285
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11286 execargs[0] = browser;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11287 execargs[1] = url;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11288 execargs[2] = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11289
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11290 /* Special case for Web Explorer, it requires file:/// instead
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11291 * of file:// so I am handling it here.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11292 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11293 if(len > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11294 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11295 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
11296 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11297 int newlen, z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11298 newurl = malloc(strlen(url) + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11299 sprintf(newurl, "file:///%s", &url[7]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11300 newlen = strlen(newurl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11301 for(z=8;z<(newlen-8);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11302 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11303 if(newurl[z] == '|')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11304 newurl[z] = ':';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11305 if(newurl[z] == '/')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11306 newurl[z] = '\\';
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 execargs[1] = newurl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11309 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11310 }
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 ret = dw_exec(browser, DW_EXEC_GUI, execargs);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11313
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11314 if(olddir)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11315 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11316 _SetPath(olddir);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11317 free(olddir);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11318 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11319 if(newurl)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11320 free(newurl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11321 return ret;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11322 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11323
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11324 /*
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11325 * 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
11326 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11327 * 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
11328 * 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
11329 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11330 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
11331 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11332 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11333 action = action;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11334 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11335
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11336 /*
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11337 * 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
11338 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11339 * 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
11340 * 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
11341 * be rendered.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11342 * Returns:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11343 * 0 on success.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11344 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11345 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
11346 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11347 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11348 string = string;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11349 return -1;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11350 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11351
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11352 /*
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11353 * 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
11354 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11355 * 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
11356 * 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
11357 * 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
11358 * Returns:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11359 * 0 on success.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11360 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11361 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
11362 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11363 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11364 url = url;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11365 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11366 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11367
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11368 /*
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11369 * Create a new HTML window (widget) to be packed.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11370 * 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
11371 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11372 * 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
11373 * 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
11374 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11375 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
11376 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11377 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
11378 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
11379 return 0;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11380 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11381
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11382 typedef struct _dwprint
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11383 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11384 HDC hdc;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11385 char *printername;
1183
0f85796c6988 Fix calling convention of print callback on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1182
diff changeset
11386 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
11387 void *drawdata;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11388 unsigned long flags;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11389 unsigned int startpage, endpage;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11390 char *jobname;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11391 } DWPrint;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11392
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11393 /* 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
11394 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
11395 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11396 DWPrint *print = (DWPrint *)data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11397 DWDialog *dwwait = (DWDialog *)print->printername;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11398
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11399 window = (HWND)dwwait->data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11400
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11401 dw_window_destroy(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11402 dw_dialog_dismiss(dwwait, NULL);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11403 return FALSE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11404 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11405
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11406 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
11407 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11408 DWPrint *print = (DWPrint *)data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11409 DWDialog *dwwait = (DWDialog *)print->printername;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11410 HWND printerlist, startspin, endspin;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11411 char *result = NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11412
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11413 window = (HWND)dwwait->data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11414 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
11415 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
11416 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
11417 if(printerlist)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11418 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11419 char printername[32] = "";
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11420 int selected = dw_listbox_selected(printerlist);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11421
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11422 /* 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
11423 if(selected != DW_ERROR_UNKNOWN)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11424 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11425 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
11426 if(printername[0])
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11427 print->printername = result = strdup(printername);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11428 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11429 /* Get the start and end positions */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11430 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
11431 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
11432
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11433 /* 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
11434 if(print->startpage > print->endpage)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11435 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11436 print->endpage = print->startpage;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11437 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
11438 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11439 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11440
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11441 dw_window_destroy(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11442 dw_dialog_dismiss(dwwait, (void *)result);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11443 return FALSE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11444 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11445
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11446 /* 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
11447 BOOL _ExtractLogAddress(char * LogAddress, char * DetailStr)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11448 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11449 char *p;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11450
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11451 p = DetailStr;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11452 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
11453 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
11454 while(*p != ';') *LogAddress++ = *p++;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11455 *LogAddress = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11456 return TRUE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11457 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11458
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11459 BOOL _ExtractDriverName(char * DriverName, char * DetailStr)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11460 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11461 char *p;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11462
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11463 p = DetailStr;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11464 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
11465 while(*p != '.' && *p != ';' && *p != ',')
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11466 *DriverName++ = *p++;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11467 *DriverName = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11468 return TRUE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11469 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11470
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
11471 /* 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
11472 #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
11473 #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
11474 #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
11475
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11476 /*
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11477 * 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
11478 * Parameters:
1152
58b5374355ab Added print jobname parameter to dw_print_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1150
diff changeset
11479 * 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
11480 * 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
11481 * 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
11482 * 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
11483 * 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
11484 * Returns:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11485 * 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
11486 */
1152
58b5374355ab Added print jobname parameter to dw_print_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1150
diff changeset
11487 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
11488 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11489 char printername[32], tmpbuf[20];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11490 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
11491 DWDialog *dwwait;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11492 DWPrint *print;
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11493 PVOID pBuf = NULL;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11494 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
11495 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
11496 SPLERR splerr = 0 ;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11497 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
11498 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
11499
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11500 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
11501 return NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11502
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11503 print->drawfunc = drawfunc;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11504 print->drawdata = drawdata;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11505 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
11506 print->startpage = 1;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11507 print->endpage = pages;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11508 print->flags = flags;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11509
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11510 /* 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
11511 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
11512
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11513 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
11514 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11515 /* 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
11516 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
11517
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11518 /* 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
11519 cbBuf = cbNeeded;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11520
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11521 /* 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
11522 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
11523 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11524
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11525 /* 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
11526 if(cb > 2)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11527 printername[cb-2] = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11528 else
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11529 printername[0] = '\0';
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11530
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11531 /* 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
11532 if(!cRes && !printername[0])
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11533 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11534 /* Show an error and return failure */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11535 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
11536 free(print);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11537 return NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11538 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11539
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11540 /* Create the print dialog */
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
11541 window = dw_window_new(HWND_DESKTOP, "Choose Printer", FCF_TITLEBAR | FCF_DLGBORDER | FCF_CLOSEBUTTON | FCF_SYSMENU);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11542
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11543 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
11544
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11545 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
11546
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11547 printerlist = dw_listbox_new(0, FALSE);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11548 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
11549
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11550 /* 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
11551 if(pBuf && cRes)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11552 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11553 int count = 0;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11554
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11555 pRes = (PPRINTERINFO)pBuf ;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11556 while(cRes--)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11557 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11558 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
11559 /* 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
11560 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
11561 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
11562 count++;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11563 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11564 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11565 else
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11566 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11567 /* 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
11568 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
11569 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
11570 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11571
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11572 /* 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
11573 if(pBuf)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11574 DosFreeMem(pBuf);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11575
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11576 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
11577
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11578 /* Start spinbutton */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11579 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
11580
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11581 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
11582
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11583 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
11584 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
11585 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
11586
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11587 button = dw_spinbutton_new("1", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11588 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
11589 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
11590 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
11591
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11592 /* End spinbutton */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11593 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
11594
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11595 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
11596
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11597 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
11598 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
11599 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
11600
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11601 sprintf(tmpbuf, "%d", pages);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11602 button = dw_spinbutton_new(tmpbuf, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11603 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
11604 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
11605 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
11606
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11607 /* Ok and Cancel buttons */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11608 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
11609
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11610 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
11611 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
11612
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11613 button = dw_button_new("Ok", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11614 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
11615
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11616 dwwait = dw_dialog_new((void *)window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11617 /* 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
11618 print->printername = (char *)dwwait;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11619
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11620 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
11621
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11622 button = dw_button_new("Cancel", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11623 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
11624
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11625 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
11626 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
11627
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11628 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
11629
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11630 dw_window_show(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11631
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11632 print->printername = dw_dialog_wait(dwwait);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11633
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11634 /* The user picked a printer */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11635 if(print->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11636 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11637 char PrintDetails[256];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11638 char DriverName[32];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11639 char LogAddress[32];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11640 DEVOPENSTRUC dop;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11641
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11642 /* 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
11643 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
11644 _ExtractLogAddress(LogAddress, PrintDetails);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11645 _ExtractDriverName(DriverName, PrintDetails);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11646 dop.pszDriverName = (PSZ)DriverName;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11647 dop.pszLogAddress = (PSZ)LogAddress;
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11648 dop.pdriv = NULL;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11649 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
11650 /* 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
11651 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
11652 if(print->hdc)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11653 return print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11654 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11655 /* The user canceled */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11656 if(print->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11657 free(print->printername);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11658 free(print);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11659 return NULL;
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11660 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11661
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11662 /*
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11663 * 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
11664 * Parameters:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11665 * 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
11666 * 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
11667 * Returns:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11668 * 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
11669 */
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11670 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
11671 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11672 DWPrint *p = print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11673 HPIXMAP pixmap;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11674 int x, result = DW_ERROR_UNKNOWN;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11675 SIZEL sizl = { 0, 0 };
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11676
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11677 if(!p)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11678 return result;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11679
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11680 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
11681 return result;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11682
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11683 /* Start the job */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11684 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
11685
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
11686 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
11687 pixmap->hdc = p->hdc;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11688 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
11689 pixmap->transcolor = DW_RGB_TRANSPARENT;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11690 pixmap->width = sizl.cx;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11691 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
11692 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
11693
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11694 /* Cycle through each page */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11695 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
11696 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11697 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
11698 /* Next page */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11699 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
11700 }
1183
0f85796c6988 Fix calling convention of print callback on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1182
diff changeset
11701 /* Determine the completion code */
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11702 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
11703 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11704 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
11705 /* 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
11706 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
11707 }
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
11708 else
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
11709 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
11710 /* Free memory */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11711 dw_pixmap_destroy(pixmap);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11712 if(p->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11713 free(p->printername);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11714 free(p);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11715 return result;
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11716 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11717
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11718 /*
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11719 * 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
11720 * Parameters:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11721 * 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
11722 */
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11723 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
11724 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11725 DWPrint *p = print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11726
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11727 if(p)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11728 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
11729 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11730
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11731 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11732 * Returns a pointer to a static buffer which containes the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11733 * current user directory. Or the root directory (C:\ on
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11734 * OS/2 and Windows).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11735 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11736 char * API dw_user_dir(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11737 {
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11738 static char _user_dir[MAX_PATH+1] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11739
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11740 if(!_user_dir[0])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11741 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11742 char *home = getenv("HOME");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11743
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11744 if(home)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11745 strcpy(_user_dir, home);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11746 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11747 strcpy(_user_dir, "C:\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11748 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11749 return _user_dir;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11750 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11751
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11752 /*
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11753 * 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
11754 * 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
11755 */
1384
156e32814c83 Cleanup of the previous commits and added Unix support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1382
diff changeset
11756 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
11757 {
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11758 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
11759 }
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11760
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11761 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11762 * Call a function from the window (widget)'s context.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11763 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11764 * handle: Window handle of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11765 * function: Function pointer to be called.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11766 * data: Pointer to the data to be passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11767 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11768 void API dw_window_function(HWND handle, void *function, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11769 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11770 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11771 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11772
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11773 /* 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
11774 * 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
11775 * 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
11776 */
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
11777 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
11778 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11779 UserData *tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11780
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11781 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11782 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11783 if(stricmp(tmp->varname, varname) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11784 return tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11785 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11786 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11787 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
11788 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11789
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
11790 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
11791 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11792 UserData *new = _find_userdata(root, varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11793
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11794 if(new)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11795 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11796 new->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11797 return TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11798 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11799 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11800 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11801 new = malloc(sizeof(UserData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11802 if(new)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11803 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11804 new->varname = strdup(varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11805 new->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11806
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11807 new->next = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11808
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11809 if (!*root)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11810 *root = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11811 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11812 {
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
11813 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
11814
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11815 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11816 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11817 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11818 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11819 }
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
11820 prev->next = new;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11821 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11822 return TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11823 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11824 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11825 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
11826 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11827
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
11828 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
11829 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11830 UserData *prev = NULL, *tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11831
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11832 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11833 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11834 if(all || stricmp(tmp->varname, varname) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11835 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11836 if(!prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11837 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11838 *root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11839 free(tmp->varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11840 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11841 if(!all)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11842 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11843 tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11844 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11845 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11846 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11847 /* If all is true we should
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11848 * never get here.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11849 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11850 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11851 free(tmp->varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11852 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11853 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11854 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11855 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11856 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11857 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11858 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11859 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11860 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11861 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11862 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
11863 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11864
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11865 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11866 * 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
11867 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11868 * 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
11869 * 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
11870 * 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
11871 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11872 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
11873 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11874 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11875
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11876 if(!blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11877 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11878 if(!dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11879 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11880
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11881 blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11882 WinSetWindowPtr(window, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11883 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11884
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11885 if(data)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11886 _new_userdata(&(blah->root), dataname, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11887 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11888 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11889 if(dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11890 _remove_userdata(&(blah->root), dataname, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11891 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11892 _remove_userdata(&(blah->root), NULL, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11893 }
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11894 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11895
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11896 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11897 * 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
11898 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11899 * 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
11900 * 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
11901 * 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
11902 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
11903 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
11904 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11905 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11906
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11907 if(blah && blah->root && dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11908 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11909 UserData *ud = _find_userdata(&(blah->root), dataname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11910 if(ud)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11911 return ud->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11912 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11913 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
11914 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11915
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11916 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11917 * 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
11918 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11919 * 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
11920 * 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
11921 * 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
11922 * Returns:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11923 * 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
11924 */
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
11925 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
11926 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11927 if(sigfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11928 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11929 int timerid = WinStartTimer(dwhab, NULLHANDLE, 0, interval);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11930
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11931 if(timerid)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11932 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11933 _new_signal(WM_TIMER, NULLHANDLE, timerid, sigfunc, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11934 return timerid;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11935 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11936 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11937 return 0;
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11938 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11939
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11940 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11941 * Removes timer callback.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11942 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11943 * 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
11944 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11945 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
11946 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11947 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11948
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11949 /* 0 is an invalid timer ID */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11950 if(!id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11951 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11952
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11953 WinStopTimer(dwhab, NULLHANDLE, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11954
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11955 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11956 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11957 if(tmp->id == id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11958 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11959 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11960 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11961 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11962 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11963 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11964 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11965 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11966 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11967 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11968 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11969 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11970 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11971 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11972 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11973 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11974 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11975 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11976 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11977 }
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11978 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11979
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11980 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11981 * Add a callback to a window event.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11982 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11983 * window: Window handle of signal to be called back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11984 * signame: A string pointer identifying which signal to be hooked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11985 * sigfunc: The pointer to the function to be used as the callback.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11986 * data: User data to be passed to the handler function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11987 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11988 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11989 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11990 ULONG message = 0, id = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11991
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11992 if(window && signame && sigfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11993 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11994 if((message = _findsigmessage(signame)) != 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11995 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11996 /* Handle special case of the menu item */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11997 if(message == WM_COMMAND && window < 65536)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11998 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11999 char buffer[15];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12000 HWND owner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12001
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12002 sprintf(buffer, "_dw_id%d", (int)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12003 owner = (HWND)dw_window_get_data(hwndApp, buffer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12004
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
12005 /* 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
12006 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
12007
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12008 if(owner)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12009 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12010 id = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12011 window = owner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12012 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12013 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12014 _new_signal(message, window, id, sigfunc, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12015 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12016 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12017 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12018
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12019 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12020 * Removes callbacks for a given window with given name.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12021 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12022 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12023 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12024 void API dw_signal_disconnect_by_name(HWND window, char *signame)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12025 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12026 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12027 ULONG message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12028
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12029 if(!window || !signame || (message = _findsigmessage(signame)) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12030 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12031
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12032 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12033 {
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
12034 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
12035 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12036 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12037 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12038 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12039 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12040 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12041 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12042 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12043 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12044 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12045 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12046 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12047 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12048 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12049 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12050 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12051 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12052 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12053 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12054 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12055 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12056
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12057 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12058 * Removes all callbacks for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12059 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12060 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12061 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12062 void API dw_signal_disconnect_by_window(HWND window)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12063 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12064 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12065
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12066 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12067 {
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
12068 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
12069 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12070 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12071 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12072 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12073 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12074 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12075 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12076 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12077 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12078 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12079 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12080 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12081 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12082 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12083 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12084 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12085 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12086 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12087 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12088 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12089 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12090
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12091 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12092 * Removes all callbacks for a given window with specified data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12093 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12094 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12095 * data: Pointer to the data to be compared against.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12096 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12097 void API dw_signal_disconnect_by_data(HWND window, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12098 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12099 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12100
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12101 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12102 {
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
12103 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
12104 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12105 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12106 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12107 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12108 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12109 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12110 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12111 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12112 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12113 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12114 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12115 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12116 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12117 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12118 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12119 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12120 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12121 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12122 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12123 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12124 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12125
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
12126 /*
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
12127 * 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
12128 * Parameters:
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
12129 * 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
12130 * 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
12131 * 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
12132 */
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
12133 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
12134 {
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
12135 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
12136 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
12137 HWND tmp = WinCreateWindow(HWND_OBJECT,
1534
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
12138 CalendarClassName,
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12139 NULL,
1534
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
12140 WS_VISIBLE,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12141 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12142 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12143 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12144 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12145 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12146 NULL);
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
12147 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
12148 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
12149 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
12150 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
12151 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
12152 }
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
12153
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12154 /*
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
12155 * 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
12156 * 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
12157 * 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
12158 * 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
12159 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12160 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
12161 {
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12162 /* 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
12163 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
12164 year--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12165 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
12166 month--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12167 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
12168 day--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12169
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12170 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
12171 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
12172 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
12173 /* 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
12174 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
12175 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12176
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
12177 /*
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
12178 * 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
12179 * 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
12180 * 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
12181 * 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
12182 * 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
12183 * 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
12184 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12185 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
12186 {
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12187 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
12188 *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
12189 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
12190 *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
12191 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
12192 *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
12193 }