annotate os2/dw.c @ 1658:6fe1e91da477

Added DW_POINTER() macro for casting parameters to (void *) Fixed issues with calculating buttons sizes with icons instead of bitmaps on OS/2 and Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 16 Apr 2012 15:43:43 +0000
parents 3d4066aab4e0
children fc135161f2b1
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 *
1556
4a9c574d5c17 Fixed on Windows showing themed static text on colored boxes when the window is glass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1548
diff changeset
5 * (C) 2000-2012 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 */
1567
91d3586cf2a4 Fix issues with resizing scrollboxes on OS/2 that are not in their initial position.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1566
diff changeset
1336 WinSetWindowPos(box, HWND_TOP, -hpos, -(cy - origy - vpos), 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
1591
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
1712 /* These will be filled in during dw_init() */
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
1713 static char months[12][20];
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
1714 static char daysofweek[7][20];
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
1715
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1716 /* 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
1717 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
1718 {
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
1719 /* 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
1720 static int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1721 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
1722 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
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 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
1725 {
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1726 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
1727
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1728 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1729 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1730
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1731 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
1732 {
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
1733 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
1734 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
1735 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
1736 {
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 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
1738 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
1739 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
1740 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
1741 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
1742 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
1743 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
1744
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1745 /* 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
1746 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
1747 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
1748 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
1749 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
1750
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 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
1752 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
1753
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1754 /* 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
1755 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
1756 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
1757 {
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
1758 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
1759
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
1760 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
1761 {
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 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
1763 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
1764 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
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 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
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 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
1769 }
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
1770 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
1771 /* 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
1772 * 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
1773 */
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 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
1775 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
1776 {
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 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
1778 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
1779 }
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
1780 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
1781 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
1782 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
1783 }
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
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 /* 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
1786 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
1787 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
1788 {
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
1789 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
1790
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
1791 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
1792 {
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 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
1794 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
1795 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
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 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
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 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
1800 }
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
1801 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
1802 /* 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
1803 * 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
1804 */
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 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
1806 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
1807 {
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 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
1809 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
1810 }
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1811 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
1812 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
1813 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
1814 }
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
1815
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 /* 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
1817 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
1818 {
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 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
1820 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
1821 {
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 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
1823 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
1824 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
1825 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
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 }
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
1828 }
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
1829 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
1830 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
1831 {
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1832 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
1833 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
1834 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
1835 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
1836 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
1837 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
1838 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
1839 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
1840
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1841 /* 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
1842 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
1843 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
1844
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1845 /* 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
1846 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
1847
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1848 /* 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
1849 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
1850 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
1851 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
1852 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
1853
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1854 /* 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
1855 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
1856 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
1857 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
1858 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
1859
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1860 /* 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
1861 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
1862 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
1863 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
1864 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
1865
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1866 /* 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
1867 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
1868 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
1869 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
1870 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
1871 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
1872 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
1873 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
1874 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
1875 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
1876 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
1877 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
1878
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1879 /* 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
1880 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
1881 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
1882 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
1883 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
1884 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
1885 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
1886 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
1887 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
1888 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
1889 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
1890
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1891 /* 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
1892 _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
1893 _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
1894 /* 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
1895 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
1896 _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
1897 _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
1898
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1899 /* 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
1900 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
1901 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
1902 {
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1903 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
1904
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1905 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
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 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
1908 {
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1909 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
1910 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
1911 }
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1912 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
1913 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1914
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1915 /* 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
1916 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
1917 {
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1918 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
1919 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
1920
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1921 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
1922 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
1923 {
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 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
1925 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
1926 }
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1927 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
1928 {
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 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
1930 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
1931 }
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1932 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
1933 {
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 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
1935 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
1936 }
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1937 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
1938 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1939
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1940 /* 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
1941 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
1942 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
1943 _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
1944 _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
1945 /* 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
1946 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
1947 _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
1948 _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
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 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
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 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
1953 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1954 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1955 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
1956 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
1957 }
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 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
1960 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1961
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1962
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1963 /* This procedure handles drawing of a status border */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1964 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
1965 {
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1966 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
1967 PFNWP oldproc = 0;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1968
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1969 if(msg == WM_MOUSEMOVE && _wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1970 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1971
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1972 if(blah)
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 oldproc = blah->oldproc;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1975
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1976 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1977 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1978
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1979 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1980 _TooltipProc(hWnd, msg, mp1, mp2, blah);
643
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 switch(msg)
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 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1985 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1986 HPS hpsPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1987 RECTL rclPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1988 char buf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1989
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1990 hpsPaint = WinBeginPaint(hWnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1991 WinQueryWindowRect(hWnd, &rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1992 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1993
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1994 GpiSetColor(hpsPaint, CLR_DARKGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1995 _Top(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1996 _Left(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1997
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1998 GpiSetColor(hpsPaint, CLR_WHITE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1999 _Right(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2000 _Bottom(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2001
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2002 WinQueryWindowText(hWnd, 1024, (PSZ)buf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2003 rclPaint.xLeft += 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2004 rclPaint.xRight--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2005 rclPaint.yTop--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2006 rclPaint.yBottom++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2007
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2008 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
2009 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
2010 WinEndPaint(hpsPaint);
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 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2013 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2014 }
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2015 if(oldproc)
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2016 return oldproc(hWnd, msg, mp1, mp2);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2017 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2018
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2019 return WinDefWindowProc(hWnd, msg, mp1, mp2);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2020 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2021
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
2022 /* 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
2023 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
2024 {
1520
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2025 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
2026
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2027 if(blah && blah->bubbletext[0])
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2028 _TooltipProc(hWnd, msg, mp1, mp2, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2029
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2030 if(msg == WM_MOUSEMOVE &&_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2031 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2032
1520
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2033 if(blah && blah->oldproc)
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2034 {
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2035 PFNWP myfunc = blah->oldproc;
643
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 return myfunc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2038 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2039
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2040 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
2041 }
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
2042
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
2043 /* This procedure handles scrollbox */
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
2044 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
2045 {
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2046 switch(msg)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2047 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2048 case WM_PAINT:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2049 {
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
2050 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
2051 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
2052
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 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
2054 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
2055 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
2056 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
2057 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2058 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2059 case WM_HSCROLL:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2060 case WM_VSCROLL:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2061 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2062 MPARAM res;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2063 int *pos, min, max, page, which = SHORT2FROMMP(mp2);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2064 HWND handle, client = WinWindowFromID(hWnd, FID_CLIENT);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2065 HWND box = (HWND)dw_window_get_data(hWnd, "_dw_resizebox");
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2066 HWND hscroll = WinWindowFromID(hWnd, FID_HORZSCROLL);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2067 HWND vscroll = WinWindowFromID(hWnd, FID_VERTSCROLL);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2068 int hpos = dw_scrollbar_get_pos(hscroll);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2069 int vpos = dw_scrollbar_get_pos(vscroll);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2070 int cy = (int)dw_window_get_data(hWnd, "_dw_cy");
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2071 RECTL rect;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2072
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2073 WinQueryWindowRect(client, &rect);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2074
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2075 if(msg == WM_VSCROLL)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2076 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2077 page = rect.yTop - rect.yBottom;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2078 handle = vscroll;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2079 pos = &vpos;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2080 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2081 else
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2082 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2083 page = rect.xRight - rect.xLeft;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2084 handle = hscroll;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2085 pos = &hpos;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2086 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2087
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2088 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2089 min = SHORT1FROMMP(res);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2090 max = SHORT2FROMMP(res);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2091
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2092 switch(which)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2093 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2094 case SB_SLIDERTRACK:
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2095 *pos = SHORT1FROMMP(mp2);
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2096 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2097 case SB_LINEUP:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2098 (*pos)--;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2099 if(*pos < min)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2100 *pos = min;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2101 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2102 case SB_LINEDOWN:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2103 (*pos)++;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2104 if(*pos > max)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2105 *pos = max;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2106 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2107 case SB_PAGEUP:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2108 (*pos) -= page;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2109 if(*pos < min)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2110 *pos = min;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2111 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2112 case SB_PAGEDOWN:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2113 (*pos) += page;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2114 if(*pos > max)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2115 *pos = max;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2116 break;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2117 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2118 WinSendMsg(handle, SBM_SETPOS, (MPARAM)*pos, 0);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2119 /* Position the scrolled box */
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2120 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
2121 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2122 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2123 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2124 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
2125 }
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
2126
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2127 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
2128 {
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
2129 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2130
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2131 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2132
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2133 /* These are the window classes which can
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2134 * obtain input focus.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2135 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2136 if(strncmp(tmpbuf, "#3", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2137 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2138 /* Generate click on default item */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2139 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2140
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2141 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2142 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2143 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2144 if(tmp->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2145 {
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
2146 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
2147
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2148 /* 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
2149 if(tmp->window == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2150 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2151 clickfunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2152 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2155 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2156 tmp= tmp->next;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2159 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2160 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
2161 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2162
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
2163 #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
2164 #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
2165 #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
2166 #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
2167 #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
2168
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2169 /* Originally just intended for entryfields, it now serves as a generic
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2170 * procedure for handling TAB presses to change input focus on controls.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2171 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2172 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2173 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2174 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2175 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
2176 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2177
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2178 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2179 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2180
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2181 WinQueryClassName(hWnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2182
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2183 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2184 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2185
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2186 /* 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
2187 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2188 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2189 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2190 strncmp(tmpbuf, "#32", 4)==0) /* Spinbutton */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2191 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2192 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2193 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2194 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2195 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2196 HMENUI hwndMenu = dw_menu_new(0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2197 long x, y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2198
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2199 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
2200 {
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
2201 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
2202 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
2203 }
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
2204 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
2205 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
2206 {
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
2207 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
2208 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
2209 }
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
2210 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
2211 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
2212
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2213 WinSetFocus(HWND_DESKTOP, hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2214 dw_pointer_query_pos(&x, &y);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2215 dw_menu_popup(&hwndMenu, hWnd, x, y);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2216 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2217 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2218 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2219 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2220 ULONG command = COMMANDMSG(&msg)->cmd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2221
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2222 /* MLE */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2223 if(strncmp(tmpbuf, "#10", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2224 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2225 switch(command)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2226 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2227 case ENTRY_CUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2228 return WinSendMsg(hWnd, MLM_CUT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2229 case ENTRY_COPY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2230 return WinSendMsg(hWnd, MLM_COPY, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2231 case ENTRY_PASTE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2232 return WinSendMsg(hWnd, MLM_PASTE, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2233 case ENTRY_UNDO:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2234 return WinSendMsg(hWnd, MLM_UNDO, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2235 case ENTRY_SALL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2236 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2237 ULONG len = (ULONG)WinSendMsg(hWnd, MLM_QUERYTEXTLENGTH, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2238 return WinSendMsg(hWnd, MLM_SETSEL, 0, (MPARAM)len);
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2242 else /* Other */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2243 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2244 HWND handle = hWnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2245
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2246 /* Get the entryfield handle from multi window controls */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2247 if(strncmp(tmpbuf, "#2", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2248 handle = WinWindowFromID(hWnd, 667);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2249
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2250 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2251 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2252 switch(command)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2253 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2254 case ENTRY_CUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2255 return WinSendMsg(handle, EM_CUT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2256 case ENTRY_COPY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2257 return WinSendMsg(handle, EM_COPY, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2258 case ENTRY_PASTE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2259 return WinSendMsg(handle, EM_PASTE, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2260 case ENTRY_SALL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2261 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2262 LONG len = WinQueryWindowTextLength(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2263 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
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2269 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2273 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2274 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2275 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2276 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2277 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2278 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2279 if(strncmp(tmpbuf, "#32", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2280 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2281 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2282 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2283 case WM_CONTROL:
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2284 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2285 if(strncmp(tmpbuf, "#38", 4)==0)
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2286 _run_event(hWnd, msg, mp1, mp2);
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2287 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2288 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2289 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2290 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2291 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2292 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2293 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2294 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2295 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2296 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2297 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2298 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2299 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2300 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2301 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2302 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2303 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2304 _click_default(blah->clickdefault);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2305 /* 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
2306 * window hangs for reasons unknown. (in an MLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2307 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2308 else if(SHORT1FROMMP(mp2) == 283)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2309 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2310
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2311 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2312 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2313 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2314 /* 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
2315 if(strncmp(tmpbuf, "#38", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2316 WinPostMsg(hWnd, WM_USER+7, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2317 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2318 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2319 case WM_USER+7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2320 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2321 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
2322 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
2323 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2324 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2325 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2326 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2327 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2328 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2331 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2332 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2333
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2334 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
2335 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2336
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2337 /* 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
2338 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
2339 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2340 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2341
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2342 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2343 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2344
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2345 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2346 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2347 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2348 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2349 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2350 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2351 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2352 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2353 return _entryproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2354 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2355 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2356 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2357 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2358 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2359 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2360 /* 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
2361 if(SHORT1FROMMP(mp2) == 283)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2362 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2363 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2366 if(blah && blah->oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2367 return blah->oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2368
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2369 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
2370 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2371
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2372 /* 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
2373 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
2374 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2375 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2376 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2377 case WM_VSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2378 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2379 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2380 USHORT pos = SHORT1FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2381
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2382 WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2383 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2384 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2385 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2386 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
2387 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2388
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2389 /* Handle special messages for the spinbutton's entryfield */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2390 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2391 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2392 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2393 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2394
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2395 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2396 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2397
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2398 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2399 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2400
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2401 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2402 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2403 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2404 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2405 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2406 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2407 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2408 case WM_COMMAND:
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2409 return _entryproc(hWnd, msg, mp1, mp2);
643
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2412 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2413 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2414
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2415 return WinDefWindowProc(hWnd, msg, mp1, mp2);
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2416 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2417
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2418 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
2419 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2420 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
2421 int range = _dw_percent_get_range(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2422 float fpos = (float)pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2423 float frange = (float)range;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2424 float fnew = (fpos/1000.0)*frange;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2425 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
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
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2428 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
2429 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2430 int inew, range = _dw_percent_get_range(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2431 if(range)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2432 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2433 float fpos = (float)pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2434 float frange = (float)range;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2435 float fnew = (fpos/frange)*1000.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2436 inew = (int)fnew;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2437 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
2438 }
94
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
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2441 /* 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
2442 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
2443 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2444 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2445 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2446
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2447 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2448 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2449
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2450 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2451 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2452
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2453 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2454 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2455 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2456 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2457 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2458 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2459 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2460 WinPostMsg(hWnd, WM_USER+7, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2461 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2462 case WM_USER+7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2463 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
2464 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2467 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2468 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2469
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2470 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2471 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2472
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2473 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2474 * flag enabled, and also handle TABs to switch input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2475 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2476 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2477 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2478 WindowData *blah = WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2479 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2480
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2481 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2482 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2483
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2484 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2485 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2486
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2487 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2488 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2489 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2490 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2491 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2492 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2493 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2494 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2495 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2496 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2497 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2498 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2499 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2500 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2501 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2502 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2503 _click_default(blah->clickdefault);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2504 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2505 case WM_BUTTON1DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2506 case WM_BUTTON2DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2507 case WM_BUTTON3DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2508 if(dw_window_get_data(hWnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2509 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2510 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2511 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2512 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2513 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2514 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2515 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2516 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2517 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2518 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2519 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2520 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2521 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2522 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2523 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
2524 HPS hpsPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2525 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2526 unsigned long width, height, thumbheight = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2527 ULONG color;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2528
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2529 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
2530 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
2531
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2532 if(!thumbheight)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2533 thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2534
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2535 /* 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
2536 thumbheight += 6;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2537
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2538 color = (ULONG)dw_window_get_data(parent, "_dw_fore");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2539 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
2540
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2541 if(height > thumbheight)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2542 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2543 hpsPaint = WinGetPS(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2544 if(color)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2545 GpiSetColor(hpsPaint, _internal_color(color-1));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2546 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2547 GpiSetColor(hpsPaint, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2548
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2549 ptl.x = ptl.y = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2550 GpiMove(hpsPaint, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2551
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2552 ptl.x = width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2553 ptl.y = height - thumbheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2554 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2555
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2556 WinReleasePS(hpsPaint);
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2559 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2560 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2561 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2562 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2563
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2564 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2565 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2566
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2567 void _GetPPFont(HWND hwnd, char *buff)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2568 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2569 ULONG AttrFound;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2570 BYTE AttrValue[128];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2571 ULONG cbRetLen;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2572
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2573 cbRetLen = WinQueryPresParam(hwnd,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2574 PP_FONTNAMESIZE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2575 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2576 &AttrFound,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2577 sizeof(AttrValue),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2578 &AttrValue,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2579 QPF_NOINHERIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2580
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2581 if(PP_FONTNAMESIZE == AttrFound && cbRetLen)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2582 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2583 memcpy(buff, AttrValue, cbRetLen);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2584 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2585 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2586
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
2587 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
2588 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2589 MPARAM res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2590 int min, max, page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2591
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2592 if(which == SB_SLIDERTRACK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2593 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2594
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2595 pos = dw_scrollbar_get_pos(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2596 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2597
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2598 min = SHORT1FROMMP(res);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2599 max = SHORT2FROMMP(res);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2600 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
2601
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2602 switch(which)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2603 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2604 case SB_LINEUP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2605 pos = pos - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2606 if(pos < min)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2607 pos = min;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2608 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2609 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2610 case SB_LINEDOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2611 pos = pos + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2612 if(pos > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2613 pos = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2614 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2615 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2616 case SB_PAGEUP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2617 pos = pos - page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2618 if(pos < min)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2619 pos = min;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2620 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2621 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2622 case SB_PAGEDOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2623 pos = pos + page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2624 if(pos > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2625 pos = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2626 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2627 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2628 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2629 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
2630 }
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
2631
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2632 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
2633 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2634 if(hwndEmph && WinIsWindow(dwhab, hwndEmph) && pCoreEmph)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2635 WinSendMsg(hwndEmph, CM_SETRECORDEMPHASIS, pCoreEmph, MPFROM2SHORT(FALSE, CRA_SOURCE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2636 hwndEmph = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2637 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
2638 }
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2639
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
2640 /* 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
2641 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
2642 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2643 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
2644 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
2645
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2646 /* Find the toplevel window */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2647 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
2648 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2649 menubar = (int)dw_window_get_data(lastowner, "_dw_menubar");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2650 lastowner = menuowner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2651 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2652 if(menuowner && menubar)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2653 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2654 HWND client = WinWindowFromID(menuowner, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2655
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2656 return client ? client : menuowner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2657 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2658 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
2659 }
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
2660
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2661 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2662 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2663 int result = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2664 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2665 ULONG origmsg = msg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2666
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2667 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2668 msg = WM_BUTTON1DOWN;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2669 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2670 msg = WM_BUTTON1UP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2671 if(msg == WM_VSCROLL || msg == WM_HSCROLL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2672 msg = WM_CONTROL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2673
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2674 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2675 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2676 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2677 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
2678 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2679 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2680 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2681 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2682 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2683 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
2684 {
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
2685 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
2686
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2687 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
2688 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2689 result = setfocusfunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2690 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2694 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2695 case WM_TIMER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2696 {
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
2697 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
2698 if(tmp->id == (int)mp1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2699 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2700 if(!timerfunc(tmp->data))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2701 dw_timer_disconnect(tmp->id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2702 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2703 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2704 result = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2705 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2706 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2707 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2708 {
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
2709 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
2710
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2711 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
2712 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2713 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
2714 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2717 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2718 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2719 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2720 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
2721 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
2722
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2723 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
2724 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2725 int button = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2726
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2727 switch(origmsg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2728 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2729 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2730 button = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2731 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2732 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2733 button = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2734 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2735 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2736 button = 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2737 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2738 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2739
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
2740 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
2741 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2744 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2745 case WM_BUTTON1UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2746 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2747 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
2748 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
2749
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2750 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
2751 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2752 int button = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2753
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2754 switch(origmsg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2755 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2756 case WM_BUTTON1UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2757 button = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2758 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2759 case WM_BUTTON2UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2760 button = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2761 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2762 case WM_BUTTON3UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2763 button = 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2764 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2767 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
2768 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2771 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2772 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2773 {
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
2774 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
2775
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2776 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
2777 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2778 int keys = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2779 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2780
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2781 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2782 keys = DW_BUTTON1_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2783 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2784 keys |= DW_BUTTON2_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2785 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2786 keys |= DW_BUTTON3_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2787
956
a3e4cebf3c99 Fixed incorrectly using _get_frame_height() instead of _get_height() which resulted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 906
diff changeset
2788 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
2789 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2792 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2793 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2794 {
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
2795 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
2796
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2797 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
2798 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2799 int vk;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2800 char ch = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2801
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2802 if(SHORT1FROMMP(mp1) & KC_CHAR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2803 ch = (char)SHORT1FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2804 if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2805 vk = SHORT2FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2806 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2807 vk = SHORT1FROMMP(mp2) + 128;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2808
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2809 /* This is a hack to fix shift presses showing
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2810 * up as tabs!
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2811 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2812 if(ch == '\t' && !(SHORT1FROMMP(mp1) & KC_CHAR))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2813 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2814 ch = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2815 vk = VK_SHIFT;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2818 result = keypressfunc(tmp->window, ch, vk,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2819 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
2820 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2823 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2824 case WM_CLOSE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2825 {
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
2826 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
2827
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2828 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
2829 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2830 result = closefunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2831 if(result)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2832 result = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2833 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2836 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2837 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2838 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2839 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2840 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
2841 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
2842 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2843
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2844 if(hWnd == tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2845 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2846 int height = _get_height(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2847
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2848 hps = WinBeginPaint(hWnd, 0L, &rc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2849 exp.x = rc.xLeft;
1646
8493f8888893 Fixed off by one in the y field of the expose event on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1645
diff changeset
2850 exp.y = height - rc.yTop;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2851 exp.width = rc.xRight - rc. xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2852 exp.height = rc.yTop - rc.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2853 result = exposefunc(hWnd, &exp, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2854 WinEndPaint(hps);
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2857 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2858 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2859 {
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
2860 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
2861 ULONG command = COMMANDMSG(&msg)->cmd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2862
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2863 if(tmp->id && command == tmp->id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2864 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2865 HWND menuowner = _menu_owner(tmp->window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2866
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2867 if(menuowner == hWnd || menuowner == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2868 {
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
2869 result = clickfunc((HWND)tmp->id, tmp->data);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2870 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2873 else if(tmp->window < 65536 && command == tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2874 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2875 result = clickfunc(popup ? popup : tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2876 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2879 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2880 case WM_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2881 if(origmsg == WM_VSCROLL || origmsg == WM_HSCROLL || tmp->message == SHORT2FROMMP(mp1) ||
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2882 (tmp->message == SLN_SLIDERTRACK && (SHORT2FROMMP(mp1) == SLN_CHANGE || SHORT2FROMMP(mp1) == SPBN_CHANGE)))
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2883 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2884 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
2885 int id = SHORT1FROMMP(mp1);
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2886 HWND notifyhwnd = dw_window_from_id(hWnd, id);
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2887
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2888 if(origmsg == WM_CONTROL)
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2889 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2890 svar = SHORT2FROMMP(mp1);
1636
1d3013463204 Fixed a couple warnings generated by the new OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1625
diff changeset
2891 if(!notifyhwnd && WinIsWindow(dwhab, (HWND)mp2))
1d3013463204 Fixed a couple warnings generated by the new OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1625
diff changeset
2892 notifyhwnd = (HWND)mp2;
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2893 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2894
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2895 switch(svar)
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 case CN_ENTER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2898 {
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
2899 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
2900 char *text = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2901
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2902 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2903 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2904 PRECORDCORE pre;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2905
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2906 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2907 if(pre)
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2908 text = (char *)pre->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2909 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2910
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2911 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2912 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2913 result = containerselectfunc(tmp->window, text, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2914 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2915 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2916 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2917 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2918 case CN_EXPANDTREE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2919 {
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
2920 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
2921
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2922 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2923 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2924 result = treeexpandfunc(tmp->window, (HTREEITEM)mp2, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2925 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2926 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2927 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2928 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2929 case CN_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2930 {
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
2931 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
2932 char *text = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2933 void *user = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2934 LONG x,y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2935
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2936 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2937 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2938 PCNRITEM pci;
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 pci = (PCNRITEM)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2941
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2942 text = (char *)pci->rc.pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2943 user = pci->user;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2946 dw_pointer_query_pos(&x, &y);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2947
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2948 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2949 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2950 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
2951
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2952 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2953 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2954 if(!container)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2955 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2956 NOTIFYRECORDEMPHASIS pre;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2957
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2958 dw_tree_item_select(tmp->window, (HTREEITEM)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2959 pre.pRecord = mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2960 pre.fEmphasisMask = CRA_CURSORED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2961 pre.hwndCnr = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2962 _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
2963 pre.pRecord->flRecordAttr |= CRA_CURSORED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2964 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2965 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2966 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2967 if(pCoreEmph)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2968 _clear_emphasis();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2969 hwndEmph = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2970 pCoreEmph = mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2971 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
2972 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2973 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2974 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
2975 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2976 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2977 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2978 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2979 case CN_EMPHASIS:
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 PNOTIFYRECORDEMPHASIS pre = (PNOTIFYRECORDEMPHASIS)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2982 static int emph_recurse = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2983
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2984 if(!emph_recurse)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2985 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2986 emph_recurse = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2987
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2988 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2989 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2990 if(tmp->window == pre->hwndCnr)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2991 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2992 PCNRITEM pci = (PCNRITEM)pre->pRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2993
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2994 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
2995 {
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
2996 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
2997
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2998 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
2999 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
3000 else
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 if(lasthcnr == tmp->window && lastitem == (HWND)pci)
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 = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3005 lastitem = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3006 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3007 else
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 lasthcnr = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3010 lastitem = (HWND)pci;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
3011 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
3012 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3013 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3014 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3017 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3018 emph_recurse = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3019 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3020 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3021 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3022 case LN_SELECT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3023 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3024 char classbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3025
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
3026 WinQueryClassName(tmp->window, 99, (PCH)classbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3027
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3028 if(strncmp(classbuf, "#38", 4) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3029 {
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
3030 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
3031
1197
cad6f7aa421c Fixed a couple slight issues with the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1196
diff changeset
3032 if(tmp->window == hWnd || tmp->window == notifyhwnd)
643
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 static int lastvalue = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3035 static HWND lasthwnd = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3036 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
3037 if(lastvalue != ulValue || lasthwnd != tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3038 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3039 result = valuechangedfunc(tmp->window, ulValue, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3040 lastvalue = ulValue;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3041 lasthwnd = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3042 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3043 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3044 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3045 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3046 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3047 {
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
3048 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
3049 static int _recursing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3050
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
3051 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
3052 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3053 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
3054 int index = dw_listbox_selected(tmp->window);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3055
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3056 dw_listbox_get_text(tmp->window, index, buf1, 500);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3057
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3058 _recursing = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3059
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3060 if(id && strncmp(classbuf, "#2", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3061 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3062 char *buf2;
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 buf2 = dw_window_get_text(tmp->window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3065
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3066 /* 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
3067 * 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
3068 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3069 if(buf2 && *buf2 && *buf1 && strncmp(buf1, buf2, 500) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3070 result = listboxselectfunc(tmp->window, index, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3071
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3072 if(buf2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3073 free(buf2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3074 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3075 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3076 result = listboxselectfunc(tmp->window, index, tmp->data);
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 _recursing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3079 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3080 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3081 }
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 break;
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3084 case SPBN_CHANGE:
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3085 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3086 int (API_FUNC valuechangedfunc)(HWND, int, void *) = (int (API_FUNC)(HWND, int, void *))tmp->signalfunction;
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3087
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3088 if(origmsg == WM_CONTROL && tmp->message == SLN_SLIDERTRACK)
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3089 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3090 /* Handle Spinbutton control */
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3091 if(tmp->window == hWnd || tmp->window == notifyhwnd)
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3092 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3093 int position = dw_spinbutton_get_pos(tmp->window);
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3094 result = valuechangedfunc(tmp->window, position, tmp->data);
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3095 tmp = NULL;
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3096 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3097 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3098 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3099 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3100 case SLN_SLIDERTRACK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3101 {
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
3102 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
3103
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3104 if(origmsg == WM_CONTROL)
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 /* 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
3107 if(tmp->window == hWnd || tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3108 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3109 static int lastvalue = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3110 static HWND lasthwnd = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3111 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
3112 if(lastvalue != ulValue || lasthwnd != tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3113 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3114 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
3115 result = valuechangedfunc(tmp->window, ulValue, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3116 lastvalue = ulValue;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3117 lasthwnd = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3118 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3119 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3122 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3123 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3124 /* 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
3125 if(tmp->window > 65535 && tmp->window == notifyhwnd)
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 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
3128
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3129 if(pos > -1)
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 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
3132 result = valuechangedfunc(tmp->window, pos, tmp->data);
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 result = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3135 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3139 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3140 case BKN_PAGESELECTED:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3141 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3142 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3143
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3144 if(psn && tmp->window == psn->hwndBook)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3145 {
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
3146 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
3147
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3148 result = switchpagefunc(tmp->window, psn->ulPageIdNew, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3149 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3150 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3151 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3152 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3153 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3154 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3155 break;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3158
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3159 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3160 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3161
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3162 }
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
3163 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
3164 {
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
3165 /* 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
3166 _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
3167 /* 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
3168 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3169 return (MRESULT)result;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3170 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3171
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
3172 /* 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
3173 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
3174 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3175 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
3176 long red, green, blue;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3177
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3178 red = dw_spinbutton_get_pos(button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3179 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
3180 green = dw_spinbutton_get_pos(button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3181 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
3182 blue = dw_spinbutton_get_pos(button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3183
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3184 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
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
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
3187 /* 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
3188 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
3189 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3190 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
3191 dw_window_set_data(window, "_dw_updating", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3192 dw_spinbutton_set_pos(button, DW_RED_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3193 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
3194 dw_spinbutton_set_pos(button, DW_GREEN_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3195 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
3196 dw_spinbutton_set_pos(button, DW_BLUE_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3197 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
3198 }
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
3199
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
3200 /* 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
3201 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
3202 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3203 WinSendMsg(col, 0x0602, MPFROMLONG(_os2_color(value)), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3204 if(!IS_WARP4())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3205 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
3206 }
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
3207
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3208 /* Handles control messages sent to the box (owner). */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3209 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3210 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3211 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER);
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 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3214 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3215 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3216 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3217 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3218 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3219 case WM_VSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3220 case WM_HSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3221 if(_run_event(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3222 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3223 HWND window = WinWindowFromID(hWnd, (ULONG)mp1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3224 _HandleScroller(window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3225 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3226 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3227 /* Handles Color Selection control messages */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3228 case 0x0601:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3229 case 0x130C:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3230 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3231 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
3232 unsigned long val = (unsigned long)mp1;
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(window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3235 _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
3236 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3237 break;
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3238 case WM_USER:
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3239 _run_event(hWnd, WM_CONTROL, mp1, mp2);
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3240 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3241 case WM_CONTROL:
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3242 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3243 char tmpbuf[100];
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3244
1636
1d3013463204 Fixed a couple warnings generated by the new OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1625
diff changeset
3245 WinQueryClassName((HWND)mp2, 99, (PCH)tmpbuf);
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3246 /* Don't set the ownership if it's an entryfield or spinbutton */
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3247 if(strncmp(tmpbuf, "#32", 4)==0)
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3248 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3249 if((SHORT2FROMMP(mp1) == SPBN_CHANGE || SHORT2FROMMP(mp1) == SPBN_ENDSPIN))
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3250 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3251 HWND window = (HWND)dw_window_get_data(hWnd, "_dw_window");
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3252
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3253 if(window && !dw_window_get_data(window, "_dw_updating"))
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3254 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3255 unsigned long val = _dw_color_spin_get(window);
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3256 HWND col = (HWND)dw_window_get_data(window, "_dw_col");
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3257
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3258 _dw_col_set(col, val);
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3259 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3260 }
1636
1d3013463204 Fixed a couple warnings generated by the new OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1625
diff changeset
3261 if(!dw_window_get_data((HWND)mp2, "_dw_updating"))
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3262 WinPostMsg(hWnd, WM_USER, mp1, mp2);
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3263 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3264 else
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3265 _run_event(hWnd, msg, mp1, mp2);
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3266 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3267 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3268 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3269
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3270 if(blah && blah->oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3271 return blah->oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3272
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3273 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3274 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3275
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3276 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3277 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3278 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3279 int result = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3280 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
3281 void (API_FUNC windowfunc)(PVOID) = 0L;
643
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(!command_active)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3284 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3285 /* 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
3286 command_active = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3287
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
3288 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
3289 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
3290 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
3291 result = (int)_run_event(hWnd, msg, mp1, mp2);
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 command_active = 0;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3296 /* Now that any handlers are done... do normal processing */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3297 switch( msg )
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3298 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3299 case WM_ERASEBACKGROUND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3300 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3301
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3302 case WM_PAINT:
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 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3305 RECTL rc;
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 hps = WinBeginPaint( hWnd, 0L, &rc );
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3308 WinEndPaint( hps );
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3309 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3310 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3311
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3312 case WM_SIZE:
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 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
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 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3317 return (MPARAM)TRUE;
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 if(mybox && mybox->flags != DW_MINIMIZED)
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 /* Hide the window when recalculating to reduce
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3322 * CPU load.
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 WinShowWindow(hWnd, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3325
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
3326 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
3327 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
3328
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3329 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
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 WinShowWindow(hWnd, TRUE);
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3334 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3335 case WM_MINMAXFRAME:
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 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3338 SWP *swp = (SWP *)mp1;
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 if(mybox && (swp->fl & SWP_MINIMIZE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3341 mybox->flags = DW_MINIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3342
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3343 if(mybox && (swp->fl & SWP_RESTORE))
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 if(!mybox->titlebar && mybox->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3346 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3347 mybox->flags = 0;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3350 if(mybox && (swp->fl & (SWP_MAXIMIZE | SWP_RESTORE)))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3351 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3352 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3353 SWP swp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3354
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3355 WinQueryWindowPos(swp->hwnd, &swp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3356
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3357 if(swp2.cx == swp->cx && swp2.cy == swp->cy)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3358 return FALSE;
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 mybox->flags = 0;
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 /* Hide the window when recalculating to reduce
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3363 * CPU load.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3364 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3365 WinShowWindow(hWnd, FALSE);
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 _do_resize(mybox, swp->cx, swp->cy);
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 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX)
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 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3372
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3373 for(z=0;z<mybox->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3374 _check_resize_notebook(mybox->items[z].hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3375
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3376 }
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 WinShowWindow(hWnd, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3379 }
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_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3383 switch(SHORT2FROMMP(mp1))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3384 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3385 case BKN_PAGESELECTEDPENDING:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3386 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3387 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3388 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
3389 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
3390 long x, y;
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
3391 unsigned long width, height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3392 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3393
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3394 if(pagebox && psn->ulPageIdNew != psn->ulPageIdCur)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3395 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3396 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
3397
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3398 rc.xLeft = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3399 rc.yBottom = y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3400 rc.xRight = x + width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3401 rc.yTop = y + height;
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 WinSendMsg(psn->hwndBook, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3404
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3405 _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
3406 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3407 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3408 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3409 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3410 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3411 case WM_CLOSE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3412 if(result == -1)
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 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3415 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3416 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3417 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3418 case WM_MOUSEMOVE:
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 HPOINTER pointer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3421
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3422 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
3423 (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
3424 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3425 WinSetPointer(HWND_DESKTOP, pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3426 return MRFROMSHORT(TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3427 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3428 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3429 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3430 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
3431 windowfunc = (void (API_FUNC)(void *))mp1;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3432
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3433 if(windowfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3434 windowfunc((void *)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3435 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3436 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3437 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3438 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3439 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3440 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3441 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3442 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3443 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3444 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3445 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3446 case WM_DESTROY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3447 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3448 HWND parent = WinQueryWindow(hWnd, QW_PARENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3449
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3450 /* Free memory before destroying */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3451 if(parent && WinWindowFromID(parent, FID_CLIENT) == hWnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3452 _free_window_memory(parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3453 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3454 _free_window_memory(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3455 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3456 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3457 case WM_MENUEND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3458 /* Delay removing the signal until we've executed
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3459 * the signal handler.
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 WinPostMsg(hWnd, WM_USER+2, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3462 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
3463 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
3464 /* 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
3465 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
3466 break;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3467 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
3468 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
3469 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
3470 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
3471 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
3472 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
3473 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
3474 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
3475 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3476 case WM_USER+2:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3477 _clear_emphasis();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3478 if(dw_window_get_data((HWND)mp2, "_dw_popup"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3479 _free_menu_data((HWND)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3480 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3481 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3482
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3483 if(result != -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3484 return (MRESULT)result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3485 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3486 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3487 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3488
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3489 void _changebox(Box *thisbox, int percent, int type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3490 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3491 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3492
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3493 for(z=0;z<thisbox->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3494 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3495 if(thisbox->items[z].type == TYPEBOX)
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 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3498 _changebox(tmp, percent, type);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3499 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3500 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3501 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3502 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3503 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3504 if(thisbox->items[z].hsize == SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3505 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
3506 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3507 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3508 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3509 if(thisbox->items[z].vsize == SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3510 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
3511 }
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 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3514 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3515
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3516 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
3517 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3518 float ratio = (float)percent/(float)100.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3519 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
3520 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
3521 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
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, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3524 WinShowWindow(handle2, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3525
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3526 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3527 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3528 int newx = (int)((float)x * ratio) - (SPLITBAR_WIDTH/2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3529
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3530 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
3531 _do_resize(tmp, newx - 1, y - 1);
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 dw_window_set_data(hwnd, "_dw_start", (void *)newx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3534
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3535 tmp = WinQueryWindowPtr(handle2, QWP_USER);
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 newx = x - newx - SPLITBAR_WIDTH;
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 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
3540 _do_resize(tmp, newx - 1, y - 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3541 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3542 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3543 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3544 int newy = (int)((float)y * ratio) - (SPLITBAR_WIDTH/2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3545
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3546 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
3547 _do_resize(tmp, x - 1, newy - 1);
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 tmp = WinQueryWindowPtr(handle2, QWP_USER);
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 newy = y - newy - SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3552
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3553 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
3554 _do_resize(tmp, x - 1, newy - 1);
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 dw_window_set_data(hwnd, "_dw_start", (void *)newy);
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3559 WinShowWindow(handle1, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3560 WinShowWindow(handle2, TRUE);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3561 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3562
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3563
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3564 /* This handles any activity on the splitbars (sizers) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3565 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3566 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3567 switch (msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3568 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3569 case WM_ACTIVATE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3570 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3571 return (MRESULT)(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3572
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3573 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3574 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3575 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3576 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3577 RECTL rcl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3578 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
3579 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
3580
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3581 hps = WinBeginPaint(hwnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3582
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3583 WinQueryWindowRect(hwnd, &rcl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3584
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3585 if(type == DW_HORZ)
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 ptl[0].x = rcl.xLeft + start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3588 ptl[0].y = rcl.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3589 ptl[1].x = rcl.xRight + start + 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3590 ptl[1].y = rcl.yTop;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3591 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3592 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3593 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3594 ptl[0].x = rcl.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3595 ptl[0].y = rcl.yBottom + start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3596 ptl[1].x = rcl.xRight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3597 ptl[1].y = rcl.yTop + start + 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3598 }
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3601 GpiSetColor(hps, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3602 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3603 GpiBox(hps, DRO_OUTLINEFILL, &ptl[1], 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3604 WinEndPaint(hps);
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 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3607
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3608 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3609 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3610 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
3611
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3612 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3613 WinSetPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3614 WinQuerySysPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3615 SPTR_SIZEWE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3616 FALSE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3617 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3618 WinSetPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3619 WinQuerySysPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3620 SPTR_SIZENS,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3621 FALSE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3622 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3623 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3624 case WM_BUTTON1DOWN:
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 APIRET rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3627 RECTL rclFrame;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3628 RECTL rclBounds;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3629 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
3630 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
3631 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
3632
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3633 WinQueryWindowRect(hwnd, &rclFrame);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3634 WinQueryWindowRect(hwnd, &rclBounds);
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 WinMapWindowPoints(hwnd, HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3637 (PPOINTL)&rclBounds, 2);
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 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3641 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3642 rclFrame.xLeft = start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3643 rclFrame.xRight = start + SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3644 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3645 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3646 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3647 rclFrame.yBottom = start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3648 rclFrame.yTop = start + SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3649 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3650
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3651 if(percent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3652 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3653 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds);
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 if(rc == TRUE)
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 int width = (rclBounds.xRight - rclBounds.xLeft);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3658 int height = (rclBounds.yTop - rclBounds.yBottom);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3659
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3660 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3661 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3662 start = rclFrame.xLeft - rclBounds.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3663 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3664 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3665 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3666 else
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 start = rclFrame.yBottom - rclBounds.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3669 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3670 *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
3671 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3672 _handle_splitbar_resize(hwnd, *percent, type, width, height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3673 _handle_splitbar_resize(hwnd, *percent, type, width, height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3674 }
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3677 return MRFROMSHORT(FALSE);
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 return WinDefWindowProc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3680 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3681
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
3682 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
3683 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3684 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
3685 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
3686 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
3687 MRESULT res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3688 unsigned long width, height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3689 int x = 5, y = 5;
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 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
3692
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3693 if(!oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3694 res = WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3695 res = oldproc(hwnd, msg, mp1, mp2);
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 if(icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3698 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3699 ULONG halftone = DP_NORMAL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3700 HPS hps = WinGetPS(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3701 POINTERINFO pi;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3702 int cx, cy;
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 if(dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3705 halftone = DP_HALFTONED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3706
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3707 cx = width - 10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3708 cy = height - 10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3709
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3710 if(WinQueryPointerInfo(icon, &pi))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3711 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3712 BITMAPINFOHEADER sl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3713 int newcx = cx, newcy = cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3714
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3715 /* Check the mini icon first */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3716 if(GpiQueryBitmapParameters(pi.hbmMiniColor, &sl))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3717 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3718 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
3719 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3720 newcx = sl.cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3721 newcy = sl.cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3722 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3723 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3724 /* Check the normal icon second */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3725 if(GpiQueryBitmapParameters(pi.hbmColor, &sl))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3726 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3727 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
3728 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3729 newcx = sl.cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3730 newcy = sl.cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3731 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3732 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3733 cx = newcx; cy = newcy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3734 x = (width - cx)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3735 y = (height - cy)/2;
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 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
3738 WinReleasePS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3739 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3740 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3741 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3742 x = (width - pixmap->width)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3743 y = (height - pixmap->height)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3744
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3745 if(disable && dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3746 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
3747 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3748 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
3749 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3750 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
3751 }
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3752
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3753 /* Function: BtProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3754 * Abstract: Subclass procedure for buttons
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3755 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3756
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3757 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3758 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3759 WindowData *blah = WinQueryWindowPtr(hwnd, QWL_USER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3760 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
3761 int retval = -1;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3762
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3763 if(!blah)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3764 return WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3765
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3766 oldproc = blah->oldproc;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3767
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3768 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3769 _TooltipProc(hwnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3770
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3771 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3772 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3773 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3774 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3775 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3776 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3777 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3778 return _button_draw(hwnd, msg, mp1, mp2, oldproc, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3779 case BM_SETHILITE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3780 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
3781 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3782 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3783 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3784 else
1337
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3785 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
3786 /* 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
3787 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
3788 {
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3789 RECTL rcl;
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3790
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3791 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
3792
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3793 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
3794 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
3795 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3796 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3797 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3798 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3799 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3800 case WM_BUTTON1DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3801 case WM_BUTTON2DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3802 case WM_BUTTON3DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3803 if(dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3804 return (MRESULT)FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3805 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3806 case WM_BUTTON1UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3807 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3808 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3809
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3810 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
3811 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3812 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3813 while(tmp)
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 if(tmp->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3816 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3817 /* 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
3818 if(tmp->window == hwnd)
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 /* 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
3821 * here, finishing actions on the button will occur
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3822 * 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
3823 * 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
3824 * do before we run our handler.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3825 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3826 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3827 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3828 }
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 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3831 tmp= tmp->next;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3835 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3836 case WM_USER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3837 {
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
3838 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
3839 int (API_FUNC clickfunc)(HWND, void *) = NULL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3840
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3841 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3842 {
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
3843 clickfunc = (int (API_FUNC)(HWND, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3844
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
3845 retval = clickfunc(tmp->window, tmp->data);
643
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 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3848 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3849 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3850 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3851 /* 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
3852 * while the button has the active input focus.
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 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3855 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3856 SignalHandler *tmp = Root;
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 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3859 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3860 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3861 if(tmp->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3862 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3863 /* 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
3864 if(tmp->window == hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3865 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3866 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3867 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3868 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3869 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3870 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3871 tmp= tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3872 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3873 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3874 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3875 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3876 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3877 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3878 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3879 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3880 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3881 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3882 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3883 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
3884 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3885 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3886 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3887 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3888 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
3889 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3890 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3891 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3892 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3893 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3894 break;
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3895 }
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
3896
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
3897 /* 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
3898 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
3899 _dw_redraw(0, FALSE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3900 if(!oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3901 return WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3902 return oldproc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3903 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3904
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3905 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3906 {
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3907 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
3908 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
3909
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3910 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3911 _TooltipProc(hwnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3912
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3913 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3914 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3915 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3916 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3917 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3918 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3919 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3920 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3921 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3922 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
3923 WinSetFocus(HWND_DESKTOP, hwnd);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3924 else if(res)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3925 return (MPARAM)TRUE;
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 return WinDefWindowProc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3928 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3929
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3930 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
3931 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3932 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3933 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3934
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3935 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3936 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3937
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3938 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3939 _TooltipProc(hwnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3940
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3941 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3942 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3943 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3944 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3945 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3946 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3947 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3948 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3949 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3950 RECTL rcl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3951 POINTL ptl[2];
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 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3954 oldproc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3955
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3956 hps = WinBeginPaint(hwnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3957 WinQueryWindowRect(hwnd, &rcl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3958 ptl[0].x = rcl.xLeft + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3959 ptl[0].y = rcl.yBottom + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3960 ptl[1].x = rcl.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3961 ptl[1].y = rcl.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3962
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3963 GpiSetColor(hps, CLR_BLACK);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3964 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3965 GpiBox(hps, DRO_OUTLINE, &ptl[1], 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3966 WinEndPaint(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3967 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3968 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3969 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3970 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3971 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3972 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3973 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3974 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3975 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3976 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3977 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3978 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3979 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3980 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3981 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3982 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3983
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3984 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3985
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3986 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3987 return oldproc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3988
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3989 return WinDefWindowProc(hwnd, msg, mp1, mp2);
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3990 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3991
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3992 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3993 * Initializes the Dynamic Windows engine.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3994 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3995 * newthread: True if this is the only thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3996 * False if there is already a message loop running.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3997 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3998 int API dw_init(int newthread, int argc, char *argv[])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3999 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4000 APIRET rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4001 char objnamebuf[300] = "";
1591
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4002 int x;
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4003 struct tm thistm = { 0 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4004
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4005 /* 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
4006 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
4007 {
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4008 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
4009
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4010 /* 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
4011 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
4012 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
4013
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4014 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
4015 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
4016 }
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4017 /* 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
4018 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
4019 _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
4020
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4021 if(newthread)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4022 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4023 dwhab = WinInitialize(0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4024 dwhmq = WinCreateMsgQueue(dwhab, 0);
1639
5c8a5c894ab0 Set the OS/2 codepage to 1208 (UTF-8) when creating the message queue.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1636
diff changeset
4025 /* Set the codepage to 1208 (UTF-8) */
5c8a5c894ab0 Set the OS/2 codepage to 1208 (UTF-8) when creating the message queue.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1636
diff changeset
4026 WinSetCp(dwhmq, 1208);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4027 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4028
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4029 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
4030 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
4031 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
4032 rc = WinRegisterClass(dwhab, (PSZ)CalendarClassName, _calendarproc, 0L, 32);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4033
1591
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4034 /* Fill in the the calendar fields */
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4035 for(x=0;x<7;x++)
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4036 {
1592
1795bd78207d Tab fixed for that last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1591
diff changeset
4037 thistm.tm_wday = x;
1591
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4038 strftime(daysofweek[x], 19, "%A", &thistm);
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4039 }
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4040 for(x=0;x<12;x++)
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4041 {
1592
1795bd78207d Tab fixed for that last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1591
diff changeset
4042 thistm.tm_mon = x;
1591
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4043 strftime(months[x], 19, "%B", &thistm);
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4044 }
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4045
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4046 /* Get the OS/2 version. */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4047 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
4048
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4049 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4050
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4051 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
4052 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
4053 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
4054 DefaultFont = strdup(DefaultFont);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4055
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4056 /* 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
4057 * application does and handles menu messages.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4058 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4059 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
4060 /* 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
4061 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
4062
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4063 /* 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
4064 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
4065 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
4066 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
4067 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
4068 DosQueryProcAddr(pmmerge, 5469, NULL, (PFN*)&_WinQueryDesktopWorkArea);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4069 return rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4070 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4071
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4072 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
4073
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4074 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4075 * 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
4076 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4077 void API dw_main(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4078 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4079 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4080
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4081 _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
4082 /* 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
4083 _dw_redraw(0, FALSE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4084
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4085 /* 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
4086 _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
4087
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4088 /* 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
4089 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
4090 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4091 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4092 _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
4093 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4094 }
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4095 }
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4096
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4097 /*
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4098 * 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
4099 */
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4100 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
4101 {
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4102 _dw_main_running = FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4103 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4104
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4105 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4106 * 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
4107 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4108 * 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
4109 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4110 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
4111 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4112 QMSG qmsg;
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4113 #ifdef __EMX__
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4114 struct timeval tv, start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4115
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4116 gettimeofday(&start, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4117 gettimeofday(&tv, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4118
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4119 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
4120 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4121 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4122 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4123 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4124 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4125 _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
4126 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4127 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4128 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4129 DosSleep(1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4130 gettimeofday(&tv, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4131 }
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
4132 #else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4133 double start = (double)clock();
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 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4136 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4137 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4138 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4139 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4140 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4141 _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
4142 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4143 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4144 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4145 DosSleep(1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4146 }
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4147 #endif
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4148 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4149
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4150 /*
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
4151 * 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
4152 */
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
4153 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
4154 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4155 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4156
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4157 _dwtid = dw_thread_id();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4158
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4159 if(WinGetMsg(dwhab, &qmsg, 0, 0, 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4160 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4161 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4162 _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
4163 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4164 }
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
4165 }
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
4166
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
4167 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4168 * Free's memory allocated by dynamic windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4169 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4170 * ptr: Pointer to dynamic windows allocated
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4171 * memory to be free()'d.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4172 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4173 void API dw_free(void *ptr)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4174 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4175 free(ptr);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4176 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4177
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4178 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4179 * Allocates and initializes a dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4180 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4181 * data: User defined data to be passed to functions.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4182 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4183 DWDialog * API dw_dialog_new(void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4184 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4185 DWDialog *tmp = malloc(sizeof(DWDialog));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4186
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4187 tmp->eve = dw_event_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4188 dw_event_reset(tmp->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4189 tmp->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4190 tmp->done = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4191 tmp->result = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4192
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4193 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4194 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4195
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4196 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4197 * Accepts a dialog struct and returns the given data to the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4198 * initial called of dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4199 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4200 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4201 * result: Data to be returned by dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4202 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4203 int API dw_dialog_dismiss(DWDialog *dialog, void *result)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4204 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4205 dialog->result = result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4206 dw_event_post(dialog->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4207 dialog->done = TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4208 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4209 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4210
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4211 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4212 * Accepts a dialog struct waits for dw_dialog_dismiss() to be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4213 * called by a signal handler with the given dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4214 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4215 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4216 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4217 void * API dw_dialog_wait(DWDialog *dialog)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4218 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4219 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4220 void *tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4221
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4222 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4223 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4224 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4225 _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
4226 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4227 if(dialog->done)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4228 break;
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 dw_event_close(&dialog->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4231 tmp = dialog->result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4232 free(dialog);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4233 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4234 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4235
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
4236 /*
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
4237 * 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
4238 * 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
4239 * 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
4240 * ...: 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
4241 */
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
4242 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
4243 {
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
4244 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
4245 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
4246
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
4247 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
4248 #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
4249 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
4250 #else
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4251 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
4252 #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
4253 va_end(args);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4254
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4255 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
4256 {
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
4257 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
4258
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
4259 /* 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
4260 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
4261 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
4262 _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
4263 }
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4264 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
4265 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
4266 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4267
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4268 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4269 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4270 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4271 * 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
4272 * flags: flags to indicate buttons and icon
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4273 * format: printf style format string.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4274 * ...: Additional variables for use in the format.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4275 */
399
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
4276 int API dw_messagebox(char *title, int flags, char *format, ...)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4277 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4278 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
4279 char outbuf[1025] = { 0 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4280 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4281
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4282 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
4283 #if defined(__IBMC__)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4284 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
4285 #else
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4286 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
4287 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4288 va_end(args);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4289
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4290 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
4291 if(rc == MBID_OK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4292 return DW_MB_RETURN_OK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4293 else if(rc == MBID_YES)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4294 return DW_MB_RETURN_YES;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4295 else if(rc == MBID_NO)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4296 return DW_MB_RETURN_NO;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4297 else if(rc == MBID_CANCEL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4298 return DW_MB_RETURN_CANCEL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4299 else return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4300 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4301
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4302 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4303 * Makes the window topmost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4304 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4305 * 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
4306 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4307 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
4308 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4309 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
4310 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4311
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4312 /*
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4313 * Makes the window bottommost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4314 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4315 * 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
4316 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4317 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
4318 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4319 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
4320 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4321
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4322 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4323 * Makes the window visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4324 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4325 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4326 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4327 int API dw_window_show(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4328 {
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
4329 int rc = WinShowWindow(handle, TRUE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4330 HSWITCH hswitch;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4331 SWCNTRL swcntrl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4332
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4333 _fix_button_owner(_toplevel_window(handle), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4334 WinSetFocus(HWND_DESKTOP, handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4335 _initial_focus(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4336
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4337 /* 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
4338 hswitch = WinQuerySwitchHandle(handle, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4339 if(hswitch)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4340 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4341 WinQuerySwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4342 swcntrl.uchVisibility = SWL_VISIBLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4343 WinChangeSwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4344 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4345 if(WinWindowFromID(handle, FID_CLIENT))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4346 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4347 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4348
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4349 if(blah && !(blah->flags & DW_OS2_NEW_WINDOW))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4350 {
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4351 /* Handle auto-positioning and auto-sizing */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4352 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
4353 HWND parent = WinQueryWindow(handle, QW_PARENT);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4354 int newx, newy, changed = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4355 SWP swp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4356
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4357 /* 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
4358 * 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
4359 */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4360 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
4361 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4362 WinQueryWindowPos(parent, &swp);
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4363 cx = swp.cx;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4364 cy = swp.cy;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4365 /* 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
4366 * 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
4367 */
1495
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
4368 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
4369 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4370 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
4371 return rc;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4372 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4373 }
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 blah->flags |= DW_OS2_NEW_WINDOW;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4376
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4377 WinQueryWindowPos(handle, &swp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4378
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4379 /* 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
4380 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
4381 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4382 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
4383 WinQueryWindowPos(handle, &swp);
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4384 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4385
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4386 /* 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
4387 * 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
4388 */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4389 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
4390 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4391 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
4392 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
4393
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4394 defaultx += 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4395 defaulty += 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4396
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4397 if(defaultx > maxx)
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4398 defaultx = 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4399 if(defaulty > maxy)
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4400 defaulty = 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4401
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4402 newx = defaultx;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4403 /* 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
4404 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
4405 changed = 1;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4406 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4407 else
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4408 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4409 newx = swp.x;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4410 newy = swp.y;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4411 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4412
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4413 /* 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
4414 * 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
4415 */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4416 if(swp.cx < cx && (newx+swp.cx) > cx)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4417 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4418 newx = (cx - swp.cx)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4419 changed = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4420 }
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4421 if(swp.cy < cy && (newy+swp.cy) > cy)
643
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 newy = (cy - swp.cy)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4424 changed = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4425 }
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4426
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4427 if(changed)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4428 WinSetWindowPos(handle, NULLHANDLE, newx, newy, 0, 0, SWP_MOVE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4429 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4430 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4431 return rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4432 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4433
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4434 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4435 * 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
4436 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4437 * handle: The window handle to minimize.
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4438 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4439 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
4440 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4441 HWND hwndclient = WinWindowFromID(handle, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4442
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4443 if(hwndclient)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4444 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4445 Box *box = (Box *)WinQueryWindowPtr(hwndclient, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4446
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4447 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4448 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4449 if(!box->titlebar && box->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4450 WinSetParent(box->hwndtitle, handle, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4451 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4452 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4453
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4454 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
4455 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4456
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4457 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4458 * Makes the window invisible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4459 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4460 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4461 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4462 int API dw_window_hide(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4463 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4464 HSWITCH hswitch;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4465 SWCNTRL swcntrl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4466
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4467 /* 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
4468 hswitch = WinQuerySwitchHandle(handle, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4469 if(hswitch)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4470 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4471 WinQuerySwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4472 swcntrl.uchVisibility = SWL_INVISIBLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4473 WinChangeSwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4474 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4475 return WinShowWindow(handle, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4476 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4477
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4478 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4479 * Destroys a window and all of it's children.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4480 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4481 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4482 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4483 int API dw_window_destroy(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4484 {
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4485 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
4486 Box *thisbox;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4487
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4488 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
4489 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
4490
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4491 /* 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
4492 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
4493 {
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4494 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
4495
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4496 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
4497 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
4498
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4499 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
4500 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
4501 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
4502 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4503
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4504 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
4505 thisbox = WinQueryWindowPtr(parent, QWP_USER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4506 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
4507
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4508 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4509 _free_menu_data(menu);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4510
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
4511 /* 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
4512 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
4513 {
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
4514 /* 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
4515 * 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
4516 */
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
4517 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
4518 {
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
4519 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
4520 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
4521
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
4522 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
4523 {
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
4524 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
4525 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
4526 }
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
4527
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
4528 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
4529 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
4530
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
4531 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
4532
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
4533 /* 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
4534 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
4535 {
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
4536 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
4537 }
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
4538 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
4539 {
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
4540 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
4541 }
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
4542
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
4543 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
4544 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
4545 thisbox->count--;
1654
3d4066aab4e0 Fixed windows not automatically redrawing when removing items from a layout
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1646
diff changeset
4546 /* Queue a redraw on the top-level window */
3d4066aab4e0 Fixed windows not automatically redrawing when removing items from a layout
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1646
diff changeset
4547 _dw_redraw(_toplevel_window(handle), TRUE);
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
4548 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4549 _free_window_memory(frame ? frame : handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4550 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4551 return WinDestroyWindow(frame ? frame : handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4552 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4553
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
4554 /* 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
4555 * 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
4556 * 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
4557 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4558 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
4559 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4560 HWND client = WinWindowFromID(handle, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4561 HWND window = client ? client : handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4562 Box *mybox = (Box *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4563
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4564 _fix_button_owner(_toplevel_window(handle), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4565 if(window && mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4566 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4567 unsigned long width, height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4568
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4569 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
4570
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
4571 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
4572 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
4573
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
4574 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
4575 _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
4576 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
4577 }
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
4578 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4579
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4580 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4581 * Changes a window's parent to newparent.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4582 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4583 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4584 * newparent: The window's new parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4585 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4586 void API dw_window_reparent(HWND handle, HWND newparent)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4587 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4588 HWND blah = WinWindowFromID(newparent, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4589 WinSetParent(handle, blah ? blah : newparent, TRUE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4590 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4591
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4592 /* 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
4593 * Parameters:
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4594 * currfont: current font
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4595 * Returns:
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4596 * 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
4597 */
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4598 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
4599 {
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
4600 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
4601 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
4602 int size = 9;
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4603
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4604 /* 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
4605 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
4606 {
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
4607 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
4608 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
4609 {
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
4610 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
4611 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
4612 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
4613 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
4614 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
4615 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
4616 }
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
4617 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
4618 {
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
4619 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
4620 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
4621 }
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
4622 }
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4623
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4624 /* 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
4625 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
4626 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
4627 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
4628 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
4629 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
4630 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
4631 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
4632 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
4633 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
4634
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4635 /* 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
4636 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
4637 {
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
4638 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
4639 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
4640 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
4641 }
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
4642 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
4643 /* 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
4644 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
4645 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
4646 return buf;
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4647 }
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4648
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4649 /*
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
4650 * 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
4651 * 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
4652 * 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
4653 */
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
4654 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
4655 {
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
4656 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
4657
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
4658 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
4659 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
4660 }
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
4661
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
4662 /* 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
4663 * 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
4664 */
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 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
4666 {
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 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
4668 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
4669
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 /* 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
4671 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
4672 {
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
4673 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
4674 {
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
4675 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
4676 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
4677
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
4678 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
4679 {
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
4680 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
4681 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
4682 }
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
4683 }
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
4684 }
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
4685 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
4686 }
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
4687
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
4688 /* 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
4689 * 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
4690 *
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
4691 * Render/Unspecified: 1x1
1556
4a9c574d5c17 Fixed on Windows showing themed static text on colored boxes when the window is glass.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1548
diff changeset
4692 * Scrolled(Container,Tree,MLE): Guessed size clamped to min and max in dw.h
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
4693 * 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
4694 * 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
4695 * 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
4696 * 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
4697 * 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
4698 */
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
4699 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
4700 {
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
4701 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
4702 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
4703 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
4704
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
4705 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
4706
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
4707 /* 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
4708 * 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
4709 */
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
4710 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
4711 {
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
4712 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
4713 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
4714 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
4715 }
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
4716
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
4717 /* Combobox */
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4718 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
4719 {
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
4720 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
4721 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
4722 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
4723 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
4724 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
4725 }
1534
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4726 /* Calendar */
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4727 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
4728 {
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4729 thiswidth = 200;
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4730 thisheight = 150;
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4731 }
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
4732 /* 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
4733 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
4734 {
1424
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4735 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
4736
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4737 if(hbm)
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4738 {
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4739 BITMAPINFOHEADER2 bmp;
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4740 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
4741 /* 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
4742 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
4743 {
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4744 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
4745 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
4746 }
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4747 }
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
4748 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
4749 {
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
4750 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
4751 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
4752 }
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
4753 }
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
4754 /* 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
4755 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
4756 {
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
4757 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
4758 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
4759 }
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
4760 /* 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
4761 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
4762 {
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
4763 /* 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
4764 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
4765 {
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
4766 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
4767 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
4768 }
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
4769 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
4770 {
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
4771 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
4772 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
4773 }
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
4774 }
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4775 /* Spinbutton */
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4776 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
4777 {
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
4778 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
4779 thiswidth = 50;
1459
98de42fc664d Add missing extra height from spinbuttons OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1458
diff changeset
4780 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
4781 }
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4782 /* Entryfield */
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4783 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
4784 {
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
4785 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
4786 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
4787 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
4788 }
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4789 /* MLE */
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4790 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
4791 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4792 unsigned long bytes;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4793 int height, width;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4794 char *buf, *ptr;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4795 int basicwidth;
1548
ef7959aae8da Clean up some warnings with GCC on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1547
diff changeset
4796 int wrap = (int)WinSendMsg(handle, MLM_QUERYWRAP, 0,0);
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4797
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4798 thisheight = 8;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4799 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
4800
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4801 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
4802
1548
ef7959aae8da Clean up some warnings with GCC on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1547
diff changeset
4803 ptr = buf = alloca(bytes + 2);
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4804 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
4805 buf[bytes] = 0;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4806 strcat(buf, "\n");
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4807
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4808 /* MLE */
1548
ef7959aae8da Clean up some warnings with GCC on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1547
diff changeset
4809 while((ptr = strstr(buf, "\n")))
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4810 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4811 ptr[0] = 0;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4812 width = 0;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4813 if(strlen(buf))
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4814 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
4815 else
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4816 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
4817
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4818 width += basicwidth;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4819
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4820 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
4821 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4822 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
4823 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
4824
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4825 }
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4826 else
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4827 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4828 if(width > thiswidth)
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4829 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
4830 }
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4831 thisheight += height;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4832 buf = &ptr[1];
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4833 }
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4834
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4835 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
4836 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
4837 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
4838 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
4839 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
4840 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
4841 }
1570
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4842 /* Listbox */
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4843 else if(strncmp(tmpbuf, "#7", 3)==0)
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4844 {
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4845 char buf[1025] = {0};
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4846 int x, count = dw_listbox_count(handle);
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4847 int basicwidth = thiswidth = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL) + 8;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4848
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4849 thisheight = 8;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4850
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4851 for(x=0;x<count;x++)
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4852 {
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4853 int height, width = 0;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4854
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4855 dw_listbox_get_text(handle, x, buf, 1024);
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4856
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4857 if(strlen(buf))
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4858 dw_font_text_extents_get(handle, NULL, buf, &width, &height);
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4859 else
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4860 dw_font_text_extents_get(handle, NULL, testtext, NULL, &height);
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4861
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4862 width += basicwidth;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4863
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4864 if(width > thiswidth)
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4865 thiswidth = width > _DW_SCROLLED_MAX_WIDTH ? _DW_SCROLLED_MAX_WIDTH : width;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4866 thisheight += height;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4867 }
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4868
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4869 if(thiswidth < _DW_SCROLLED_MIN_WIDTH)
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4870 thiswidth = _DW_SCROLLED_MIN_WIDTH;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4871 if(thisheight < _DW_SCROLLED_MIN_HEIGHT)
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4872 thisheight = _DW_SCROLLED_MIN_HEIGHT;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4873 if(thisheight > _DW_SCROLLED_MAX_HEIGHT)
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4874 thisheight = _DW_SCROLLED_MAX_HEIGHT;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4875 }
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4876 /* Container and Tree */
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4877 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
4878 {
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4879 /* Container */
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4880 if(dw_window_get_data(handle, "_dw_container"))
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4881 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4882 CNRINFO ci;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4883
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4884 if(WinSendMsg(handle, CM_QUERYCNRINFO, MPFROMP(&ci), MPFROMSHORT(sizeof(CNRINFO))))
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4885 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4886 RECTL item;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4887 PRECORDCORE pCore = NULL;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4888 int right = FALSE, max = 0;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4889 /* Get the left title window */
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4890 HWND title = WinWindowFromID(handle, 32752);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4891
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4892 thiswidth = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4893 thisheight = WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4894
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4895 /* If the pFieldInfoList is filled in we want to look at the right side */
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4896 if(ci.pFieldInfoLast)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4897 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4898 right = TRUE;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4899 /* Left side include splitbar position */
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4900 thiswidth += ci.xVertSplitbar + 4;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4901 /* If split... find the right side */
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4902 title = WinWindowFromID(handle, 32753);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4903 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4904
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4905 /* If there are column titles ... */
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4906 if(title)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4907 {
1569
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4908 unsigned long height = 0;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4909
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4910 dw_window_get_pos_size(title, 0, 0, 0, &height);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4911 if(height)
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4912 thisheight += height;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4913 else
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4914 thisheight += 28;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4915 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4916
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4917 /* Cycle through all the records finding the maximums */
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4918 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
1569
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4919
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4920 /* Method 1: With items in container */
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4921 if(pCore)
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4922 {
1569
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4923 while(pCore)
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4924 {
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4925 QUERYRECORDRECT qrr;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4926 int vector;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4927
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4928 qrr.cb = sizeof(QUERYRECORDRECT);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4929 qrr.pRecord = pCore;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4930 qrr.fRightSplitWindow = right;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4931 qrr.fsExtent = CMA_TEXT;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4932
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4933 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4934
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4935 vector = item.xRight - item.xLeft;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4936
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4937 if(vector > max)
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4938 max = vector;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4939
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4940 thisheight += (item.yTop - item.yBottom);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4941
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4942 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4943 }
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4944
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4945 /* Add the widest item to the width */
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4946 thiswidth += max;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4947 }
1569
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4948 else
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4949 {
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4950 /* Method 2: No items */
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4951 unsigned long width, height;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4952 HWND hscroll = WinWindowFromID(handle, right ? 32756 : 32755);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4953 MRESULT mr;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4954
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4955 /* Save the original size */
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4956 dw_window_get_pos_size(handle, 0, 0, &width, &height);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4957
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4958 /* Set the size to the minimum */
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4959 dw_window_set_size(handle, _DW_SCROLLED_MIN_WIDTH, _DW_SCROLLED_MIN_HEIGHT);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4960
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4961 /* With the minimum size check to see what the scrollbar says */
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4962 mr = WinSendMsg(hscroll, SBM_QUERYRANGE, 0, 0);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4963 if(right)
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4964 thiswidth += SHORT2FROMMP(mr);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4965 else if(SHORT2FROMMP(mr) != _DW_SCROLLED_MIN_HEIGHT)
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4966 thiswidth += SHORT2FROMMP(mr) + _DW_SCROLLED_MIN_HEIGHT + WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4967
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4968 /* Reload the original size */
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4969 dw_window_set_size(handle, width, height);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4970 }
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4971
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
4972 /* Clamp to min and max */
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4973 if(thiswidth > _DW_SCROLLED_MAX_WIDTH)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4974 thiswidth = _DW_SCROLLED_MAX_WIDTH;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4975 if(thiswidth < _DW_SCROLLED_MIN_WIDTH)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4976 thiswidth = _DW_SCROLLED_MIN_WIDTH;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4977 if(thisheight < _DW_SCROLLED_MIN_HEIGHT)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4978 thisheight = _DW_SCROLLED_MIN_HEIGHT;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4979 if(thisheight > _DW_SCROLLED_MAX_HEIGHT)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4980 thisheight = _DW_SCROLLED_MAX_HEIGHT;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4981 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4982 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4983 else
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4984 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4985 /* Tree */
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4986 thiswidth = (int)((_DW_SCROLLED_MAX_WIDTH + _DW_SCROLLED_MIN_WIDTH)/2);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4987 thisheight = (int)((_DW_SCROLLED_MAX_HEIGHT + _DW_SCROLLED_MIN_HEIGHT)/2);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
4988 }
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
4989 }
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4990 /* Button */
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4991 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
4992 {
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
4993 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
4994
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
4995 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
4996 {
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
4997 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
4998 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
4999 }
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
5000 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
5001 {
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
5002 /* 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
5003 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
5004 {
1658
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5005 HPOINTER hpr = (HPOINTER)dw_window_get_data(handle, "_dw_button_icon");
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5006 HBITMAP hbm = 0;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5007
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5008 /* Handle case of icon resource */
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5009 if(hpr)
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5010 {
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5011 POINTERINFO pi;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5012
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5013 /* Get the internal HBITMAP handles */
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5014 if(WinQueryPointerInfo(hpr, &pi))
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5015 hbm = pi.hbmColor ? pi.hbmColor : pi.hbmPointer;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5016 }
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5017
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5018 /* If we didn't load it from the icon... */
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5019 if(!hbm)
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5020 {
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5021 WNDPARAMS wp;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5022 BTNCDATA bcd;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5023
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5024 wp.fsStatus = WPM_CTLDATA;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5025 wp.cbCtlData = sizeof(BTNCDATA);
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5026 wp.pCtlData = &bcd;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5027
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5028 /* Query the button's bitmap */
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5029 if(WinSendMsg(handle, WM_QUERYWINDOWPARAMS, (MPARAM)&wp, MPVOID) && bcd.hImage)
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5030 hbm = bcd.hImage;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5031 }
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5032
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5033 /* If we got a bitmap handle */
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5034 if(hbm)
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
5035 {
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
5036 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
5037 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
5038 /* Get the parameters of the bitmap */
1658
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5039 if(GpiQueryBitmapInfoHeader(hbm, &bmp))
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
5040 {
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
5041 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
5042 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
5043 }
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
5044 }
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
5045 }
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
5046 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
5047 {
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
5048 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
5049 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
5050 }
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
5051 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
5052 {
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
5053 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
5054 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
5055 }
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
5056 }
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
5057 }
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
5058
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
5059 /* 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
5060 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
5061 *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
5062 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
5063 *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
5064 }
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
5065
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
5066 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5067 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5068 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5069 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5070 * fontname: Name and size of the font in the form "size.fontname"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5071 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5072 int API dw_window_set_font(HWND handle, char *fontname)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5073 {
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
5074 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
5075 /* 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
5076 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
5077 {
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
5078 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
5079
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
5080 /* 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
5081 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
5082 {
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
5083 _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
5084 /* 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
5085 _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
5086 }
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
5087 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
5088 }
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
5089 return DW_ERROR_UNKNOWN;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5090 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5091
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5092 /*
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5093 * 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
5094 * Parameters:
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5095 * 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
5096 * 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
5097 */
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5098 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
5099 {
1010
9af693aafa93 Attempt at implmenting dw_window_get_font on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1009
diff changeset
5100 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
5101 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
5102 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
5103 return strdup(str);
9af693aafa93 Attempt at implmenting dw_window_get_font on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1009
diff changeset
5104 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
5105 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5106
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5107 /* 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
5108 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
5109 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5110 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
5111
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5112
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5113 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
5114 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
5115
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5116 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
5117 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
5118 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5119 HWND child;
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5120 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
5121
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5122 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
5123 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5124 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
5125 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5126 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
5127 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5128 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5129 WinEndEnumWindows(henum);
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5130 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5131 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5132
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5133 /* Internal version */
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5134 int _dw_window_set_color(HWND handle, ULONG fore, ULONG back)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5135 {
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5136 /* Handle foreground */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5137 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5138 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5139 RGB2 rgb2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5140
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5141 rgb2.bBlue = DW_BLUE_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5142 rgb2.bGreen = DW_GREEN_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5143 rgb2.bRed = DW_RED_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5144 rgb2.fcOptions = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5145
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5146 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5147
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5148 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5149 else if(fore != DW_CLR_DEFAULT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5150 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5151 fore = _internal_color(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5152
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5153 WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5154 }
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5155 /* Handle background */
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5156 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
5157 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5158 /* 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
5159 ULONG pcolor;
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5160 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
5161
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5162 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
5163
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5164 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
5165 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
5166 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
5167 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
5168 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
5169 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
5170 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5171 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
5172 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5173 RGB2 rgb2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5174
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5175 rgb2.bBlue = DW_BLUE_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5176 rgb2.bGreen = DW_GREEN_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5177 rgb2.bRed = DW_RED_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5178 rgb2.fcOptions = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5179
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5180 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5181 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5182 else if(back != DW_CLR_DEFAULT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5183 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5184 back = _internal_color(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5185
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5186 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5187 }
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5188 /* 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
5189 _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
5190 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5191 }
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5192 /*
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5193 * 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
5194 * Parameters:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5195 * handle: The window (widget) handle.
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5196 * 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
5197 * 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
5198 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5199 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
5200 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5201 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
5202 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
5203
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5204 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
5205 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5206
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5207 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5208 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5209 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5210 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5211 * border: Size of the window border in pixels.
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 int API dw_window_set_border(HWND handle, int border)
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 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5216 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5217 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5218
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5219 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5220 * Captures the mouse input to this window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5221 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5222 * handle: Handle to receive mouse input.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5223 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5224 void API dw_window_capture(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5225 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5226 WinSetCapture(HWND_DESKTOP, handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5227 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5228
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5229 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5230 * Releases previous mouse capture.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5231 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5232 void API dw_window_release(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5233 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5234 WinSetCapture(HWND_DESKTOP, NULLHANDLE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5235 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5236
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5237 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5238 * Tracks this window movement.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5239 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5240 * handle: Handle to frame to be tracked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5241 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5242 void API dw_window_track(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5243 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5244 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5245 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5246
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5247 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5248 * 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
5249 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5250 * 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
5251 * 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
5252 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
5253 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
5254 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5255 HPOINTER pointer = pointertype < 65535 ?
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5256 WinQuerySysPointer(HWND_DESKTOP, pointertype, FALSE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5257 : (HPOINTER)pointertype;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5258
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5259 if(!pointertype)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5260 dw_window_set_data(handle, "_dw_pointer", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5261 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5262 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5263 WinSetPointer(HWND_DESKTOP, pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5264
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5265 if(handle != HWND_DESKTOP)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5266 dw_window_set_data(handle, "_dw_pointer", (void *)pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5267 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5268 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5269
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5270 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5271 * Create a new Window Frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5272 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5273 * owner: The Owner's window handle or HWND_DESKTOP.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5274 * title: The Window title.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5275 * flStyle: Style flags, see the PM reference.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5276 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5277 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5278 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5279 HWND hwndframe;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5280 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5281 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5282 ULONG winStyle = 0L;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5283
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5284 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
5285 newbox->vsize = newbox->hsize = SIZEEXPAND;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5286
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5287 flStyle |= FCF_NOBYTEALIGN;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5288
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5289 if(flStyle & DW_FCF_TITLEBAR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5290 newbox->titlebar = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5291 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5292 flStyle |= FCF_TITLEBAR;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5293
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5294 if(flStyle & WS_MAXIMIZED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5295 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5296 winStyle |= WS_MAXIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5297 flStyle &= ~WS_MAXIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5298 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5299 if(flStyle & WS_MINIMIZED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5300 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5301 winStyle |= WS_MINIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5302 flStyle &= ~WS_MINIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5303 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5304
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
5305 /* 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
5306 flStyle &= ~FCF_SHELLPOSITION;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5307 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
5308 /* 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
5309 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
5310 newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5311 if(!newbox->titlebar && newbox->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5312 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5313 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5314 WinSetWindowPtr(hwndframe, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5315 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5316 return hwndframe;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5317 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5318
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5319 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5320 * Create a new Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5321 * 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
5322 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5323 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5324 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5325 HWND API dw_box_new(int type, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5326 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5327 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5328
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5329 newbox->pad = pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5330 newbox->type = type;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5331 newbox->count = 0;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
5332 newbox->grouphwnd = NULLHANDLE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5333
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5334 newbox->hwnd = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5335 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5336 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5337 WS_VISIBLE | WS_CLIPCHILDREN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5338 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5339 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5340 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5341 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5342 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5343 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5344 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5345
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5346 newbox->oldproc = WinSubclassWindow(newbox->hwnd, _controlproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5347 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5348 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
5349 return newbox->hwnd;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5350 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5351
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5352 /*
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5353 * 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
5354 * Parameters:
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5355 * 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
5356 * 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
5357 */
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5358 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
5359 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5360 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
5361 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
5362 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
5363 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
5364 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
5365 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
5366 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
5367 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
5368 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
5369 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
5370 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
5371 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
5372 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
5373 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
5374 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
5375 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
5376 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
5377 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
5378 return hwndframe;
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5379 }
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5380
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
5381 /*
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5382 * 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
5383 * 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
5384 * 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
5385 * 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
5386 */
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5387 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
5388 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5389 HWND scroll;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5390
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5391 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
5392 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5393 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
5394 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5395 else
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5396 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5397 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
5398 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5399 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
5400 }
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5401
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5402 /*
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5403 * 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
5404 * 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
5405 * 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
5406 * 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
5407 */
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5408 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
5409 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5410 HWND scroll;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5411
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5412 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
5413 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5414 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
5415 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5416 else
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5417 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5418 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
5419 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5420 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
5421 }
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5422
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5423 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5424 * Create a new Group Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5425 * 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
5426 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5427 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5428 * title: Text to be displayined in the group outline.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5429 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5430 HWND API dw_groupbox_new(int type, int pad, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5431 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5432 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5433 newbox->pad = pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5434 newbox->type = type;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5435 newbox->count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5436
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5437 newbox->hwnd = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5438 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5439 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5440 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5441 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5442 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5443 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5444 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5445 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5446 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5447 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5448
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5449 newbox->grouphwnd = WinCreateWindow(newbox->hwnd,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5450 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5451 (PSZ)title,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5452 WS_VISIBLE | SS_GROUPBOX |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5453 WS_GROUP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5454 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5455 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5456 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5457 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5458 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5459 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5460
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5461 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5462 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
5463 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
5464 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
5465 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
5466 return newbox->hwnd;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5467 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5468
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5469 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5470 * 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
5471 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5472 * 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
5473 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5474 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
5475 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5476 HWND hwndframe;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5477 ULONG back = CLR_DARKGRAY;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5478
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5479 hwndframe = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5480 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5481 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5482 WS_VISIBLE | WS_CLIPCHILDREN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5483 FS_NOBYTEALIGN,
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
5484 0,0,0,0,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5485 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5486 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5487 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5488 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5489 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5490 /* 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
5491 WinSetPresParam(hwndframe, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5492 return hwndframe;
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5493 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5494
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5495 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5496 * Create a bitmap object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5497 * 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
5498 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5499 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5500 HWND API dw_bitmap_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5501 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5502 return WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5503 WC_STATIC,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5504 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5505 WS_VISIBLE | SS_TEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5506 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5507 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5508 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5509 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5510 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5511 NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5512 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5513
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5514 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5515 * Create a notebook object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5516 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5517 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5518 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5519 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5520 HWND API dw_notebook_new(ULONG id, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5521 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5522 ULONG flags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5523 HWND tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5524
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5525 if(top)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5526 flags = BKS_MAJORTABTOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5527 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5528 flags = BKS_MAJORTABBOTTOM;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5529
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5530 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5531 WC_NOTEBOOK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5532 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5533 WS_VISIBLE |
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
5534 #ifdef BKS_TABBEDDIALOG
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5535 BKS_TABBEDDIALOG |
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
5536 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5537 flags,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5538 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5539 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5540 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5541 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5542 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5543 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5544
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5545 /* Fix tab sizes on Warp 3 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5546 if(!IS_WARP4())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5547 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5548 /* best sizes to be determined by trial and error */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5549 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
5550 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5551
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5552 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5553 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5554 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5555
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5556 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5557 * Create a menu object to be popped up.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5558 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5559 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5560 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5561 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5562 HMENUI API dw_menu_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5563 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5564 HMENUI tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5565 WC_MENU,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5566 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5567 WS_VISIBLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5568 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5569 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5570 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5571 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5572 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5573 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5574 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5575 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5576
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5577 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5578 * Create a menubar on a window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5579 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5580 * location: Handle of a window frame to be attached to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5581 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5582 HMENUI API dw_menubar_new(HWND location)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5583 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5584 HMENUI tmp = WinCreateWindow(location,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5585 WC_MENU,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5586 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5587 WS_VISIBLE | MS_ACTIONBAR,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5588 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5589 location,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5590 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5591 FID_MENU,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5592 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5593 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5594 dw_window_set_data(tmp, "_dw_owner", (void *)location);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5595 dw_window_set_data(tmp, "_dw_menubar", (void *)location);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5596 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5597 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5598
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5599 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5600 * Destroys a menu created with dw_menubar_new or dw_menu_new.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5601 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5602 * menu: Handle of a menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5603 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5604 void API dw_menu_destroy(HMENUI *menu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5605 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5606 if(menu)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5607 WinDestroyWindow(*menu);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5608 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5609
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
5610 /* 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
5611 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
5612 {
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
5613 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
5614
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
5615 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
5616 {
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
5617 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
5618 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
5619 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
5620 }
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
5621 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
5622 }
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
5623
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5624 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5625 * Adds a menuitem or submenu to an existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5626 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5627 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5628 * title: The title text on the menu item to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5629 * id: An ID to be used for message passing.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5630 * flags: Extended attributes to set on the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5631 * end: If TRUE memu is positioned at the end of the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5632 * 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
5633 * flags: Extended attributes to set on the menu.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5634 * submenu: Handle to an existing menu to be a submenu or NULL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5635 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5636 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
5637 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5638 MENUITEM miSubMenu;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5639 char buffer[30];
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5640 int is_checked, is_disabled;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5641
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
5642 if ( !menux || !WinIsWindow(dwhab, menux) )
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5643 return NULLHANDLE;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5644
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5645 if ( end )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5646 miSubMenu.iPosition=MIT_END;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5647 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5648 miSubMenu.iPosition=0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5649 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5650 * Handle flags
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5651 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5652 miSubMenu.afAttribute = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5653 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
5654 if ( is_checked )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5655 miSubMenu.afAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5656 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
5657 if ( is_disabled )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5658 miSubMenu.afAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5659
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
5660 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
5661 {
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
5662 /* 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
5663 * 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
5664 */
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
5665 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
5666 {
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
5667 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
5668
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
5669 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
5670 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
5671
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
5672 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
5673 tempid = 61000;
1316
3475887f9445 Fixed tabs inserted by my editor on OS/2 again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1315
diff changeset
5674 }
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
5675 /* 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
5676 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
5677 {
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
5678 check = 0;
1316
3475887f9445 Fixed tabs inserted by my editor on OS/2 again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1315
diff changeset
5679 }
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
5680 /* 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
5681 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
5682 {
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
5683 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
5684
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
5685 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
5686 {
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
5687 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
5688 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
5689 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
5690 }
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
5691 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
5692 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
5693 }
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
5694 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
5695 }
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
5696 else
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5697 miSubMenu.afStyle = MIS_SEPARATOR;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5698 miSubMenu.id=id;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5699 miSubMenu.hwndSubMenu = submenu;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5700 miSubMenu.hItem=NULLHANDLE;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5701
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5702 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
5703
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5704 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
5705 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
5706 sprintf(buffer, "_dw_checkable%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5707 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
5708 sprintf(buffer, "_dw_ischecked%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5709 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
5710 sprintf(buffer, "_dw_isdisabled%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5711 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
5712
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5713 if ( submenu )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5714 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
5715 return (HWND)id;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5716 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5717
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5718 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5719 * 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
5720 * Deprecated; use dw_menu_item_set_state()
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5721 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5722 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5723 * id: Menuitem id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5724 * check: TRUE for checked FALSE for not checked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5725 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5726 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5727 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5728 if ( check )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5729 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
5730 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5731 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
5732 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5733
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5734 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5735 * 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
5736 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5737 * 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
5738 * id: Menuitem id.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5739 * 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
5740 * DW_MIS_CHECKED/DW_MIS_UNCHECKED
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5741 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5742 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
5743 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5744 char buffer1[30],buffer2[30];
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5745 int check;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5746 int disabled;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5747 USHORT fAttribute=0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5748
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5749 sprintf( buffer1, "_dw_ischecked%ld", id );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5750 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
5751 sprintf( buffer2, "_dw_isdisabled%ld", id );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5752 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
5753
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5754 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
5755 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5756 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5757 * 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
5758 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5759 if ( state & DW_MIS_CHECKED )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5760 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5761 fAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5762 check = 1;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5763 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5764 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5765 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5766 check = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5767 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5768 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5769 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5770 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5771 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5772 * ...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
5773 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5774 if ( check )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5775 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5776 fAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5777 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5778 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5779 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
5780 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5781 if ( state & DW_MIS_DISABLED )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5782 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5783 fAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5784 disabled = 1;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5785 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5786 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5787 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5788 disabled = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5789 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5790 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5791 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5792 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5793 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5794 * ...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
5795 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5796 if ( disabled )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5797 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5798 fAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5799 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5800 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5801 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
5802 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5803 * Keep our internal checked state consistent
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5804 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5805 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
5806 dw_window_set_data( hwndApp, buffer2, (void *)disabled );
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5807 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5808
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5809 /*
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5810 * 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
5811 * Parameters:
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5812 * 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
5813 * 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
5814 * Returns:
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5815 * 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
5816 */
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5817 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
5818 {
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
5819 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
5820 {
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5821 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
5822 /* 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
5823 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
5824 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
5825 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
5826 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5827 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
5828 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5829
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5830 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5831 * Pops up a context menu at given x and y coordinates.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5832 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5833 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5834 * parent: Handle to the window initiating the popup.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5835 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5836 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5837 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5838 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5839 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5840 if(menu)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5841 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5842 popup = parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5843 dw_window_set_data(*menu, "_dw_popup", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5844 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
5845 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5846 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5847
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5848 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5849 * Returns the current X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5850 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5851 * x: Pointer to variable to store X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5852 * y: Pointer to variable to store Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5853 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5854 void API dw_pointer_query_pos(long *x, long *y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5855 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5856 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5857
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5858 WinQueryPointerPos(HWND_DESKTOP, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5859 if(x && y)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5860 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5861 *x = ptl.x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5862 *y = dw_screen_height() - ptl.y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5863 }
3
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5867 * Sets the X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5868 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5869 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5870 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5871 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5872 void API dw_pointer_set_pos(long x, long y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5873 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5874 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5875 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5876
310
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
5877
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5878 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5879 * Create a container object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5880 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5881 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5882 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5883 */
350
2216e65ad2ae Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 347
diff changeset
5884 HWND API dw_container_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5885 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5886 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5887 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5888 WC_CONTAINER,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5889 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5890 WS_VISIBLE | CCS_READONLY |
1029
60d6d2c87116 Switched back to CCS_EXTENDSEL from CCS_MULTIPLESEL...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1024
diff changeset
5891 (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) |
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5892 CCS_AUTOPOSITION,
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
5893 0,0,0,0,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5894 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5895 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
5896 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5897 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5898 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5899 blah->oldproc = WinSubclassWindow(tmp, _TreeProc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5900 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5901 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5902 dw_window_set_data(tmp, "_dw_container", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5903 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5904 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5905
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5906 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5907 * 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
5908 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5909 * 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
5910 * 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
5911 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5912 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
5913 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5914 CNRINFO cnrinfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5915 WindowData *blah = calloc(1, sizeof(WindowData));
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_CONTAINER,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5918 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5919 WS_VISIBLE | CCS_READONLY |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5920 CCS_SINGLESEL | CCS_AUTOPOSITION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5921 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5922 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5923 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
5924 id ? id : _GlobalID(),
643
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 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5927
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5928 cnrinfo.flWindowAttr = CV_TREE | CA_TREELINE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5929 cnrinfo.slBitmapOrIcon.cx = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5930 cnrinfo.slBitmapOrIcon.cy = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5931 cnrinfo.cyLineSpacing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5932 cnrinfo.cxTreeIndent = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5933 cnrinfo.cxTreeLine = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5934
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5935 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
5936 CMA_LINESPACING | CMA_CXTREEINDENT | CMA_CXTREELINE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5937 blah->oldproc = WinSubclassWindow(tmp, _TreeProc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5938 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5939 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5940 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
5941 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5942
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5943 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5944 * Create a new static text window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5945 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5946 * 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
5947 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5948 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5949 HWND API dw_text_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5950 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5951 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5952 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5953 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5954 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5955 WS_VISIBLE | SS_TEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5956 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5957 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5958 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5959 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5960 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5961 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5962 blah->oldproc = WinSubclassWindow(tmp, _textproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5963 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5964 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
5965 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
5966 return tmp;
3
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 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5970 * 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
5971 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5972 * 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
5973 * 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
5974 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5975 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
5976 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5977 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5978 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5979 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5980 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5981 WS_VISIBLE | SS_TEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5982 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5983 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5984 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5985 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5986 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5987 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5988 blah->oldproc = WinSubclassWindow(tmp, _statusproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5989 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5990 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5991 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
5992 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
5993 return tmp;
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5994 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5995
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5996 #ifndef MLS_LIMITVSCROLL
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5997 #define MLS_LIMITVSCROLL 0x00000080L
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5998 #endif
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5999
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
6000 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6001 * Create a new Multiline Editbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6002 * 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
6003 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6004 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6005 HWND API dw_mle_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6006 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6007 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6008 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6009 WC_MLE,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6010 NULL,
1544
1fd3a9635c4d Enable MLE line wrap by default on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1537
diff changeset
6011 WS_VISIBLE | MLS_WORDWRAP |
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6012 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
6013 MLS_VSCROLL | MLS_LIMITVSCROLL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6014 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6015 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6016 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6017 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6018 NULL,
996
69cf9f26e899 Removed some code I accidentally commited to the OS/2 module.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 995
diff changeset
6019 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
6020 WinSendMsg(tmp, MLM_FORMAT, (MPARAM)MLFIE_NOTRANS, 0);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6021 blah->oldproc = WinSubclassWindow(tmp, _mleproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6022 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6023 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6024 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6025 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6026
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6027 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6028 * Create a new Entryfield window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6029 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6030 * 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
6031 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6032 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6033 HWND API dw_entryfield_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6034 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6035
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6036 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6037 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6038 WC_ENTRYFIELD,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6039 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6040 WS_VISIBLE | ES_MARGIN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6041 ES_AUTOSCROLL | WS_TABSTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6042 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6043 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6044 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6045 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6046 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6047 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6048 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6049 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6050 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6051 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
6052 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6053 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6054
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6055 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6056 * Create a new Entryfield (password) window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6057 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6058 * 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
6059 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6060 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6061 HWND API dw_entryfield_password_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6062 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6063 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6064 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6065 WC_ENTRYFIELD,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6066 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6067 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6068 ES_AUTOSCROLL | WS_TABSTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6069 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6070 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6071 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6072 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6073 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6074 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6075 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6076 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6077 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6078 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
6079 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6080 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6081
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6082 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6083 * Create a new Combobox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6084 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6085 * 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
6086 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6087 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6088 HWND API dw_combobox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6089 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6090 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6091 HWND frame = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6092 HWND tmp = WinCreateWindow(frame,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6093 WC_COMBOBOX,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6094 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6095 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6096 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6097 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6098 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
6099 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6100 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6101 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6102 HENUM henum = WinBeginEnumWindows(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6103 HWND child, last = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6104
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6105 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6106 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6107 WindowData *moreblah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6108 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6109 WinSetWindowPtr(child, QWP_USER, moreblah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6110 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
6111 last = child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6112 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6113 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6114 blah->oldproc = WinSubclassWindow(tmp, _comboproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6115 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6116 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6117 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
6118 dw_window_set_data(tmp, "_dw_comboentry", (void *)last);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6119 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
6120 WinSetOwner(tmp, frame);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6121 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6122 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6123
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6124 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6125 * Create a new button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6126 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6127 * 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
6128 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6129 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6130 HWND API dw_button_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6131 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6132 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6133 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6134 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6135 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6136 WS_VISIBLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6137 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6138 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6139 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6140 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6141 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6142 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6143
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6144 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6145
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6146 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6147 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6148 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
6149 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6150 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6151
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6152 /* Function: GenResIDStr
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6153 ** Abstract: Generate string '#nnnn' for a given ID for using with Button
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6154 ** controls
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6155 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6156
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6157 void _GenResIDStr(CHAR *buff, ULONG ulID)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6158 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6159 char *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6160 int slen = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6161
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6162 *buff++ = '#';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6163
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6164 str = buff;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6165
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6166 do
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6167 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6168 *str++ = (ulID % 10) + '0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6169 ulID /= 10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6170 slen++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6171 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6172 while(ulID);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6173
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6174 *str-- = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6175
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6176 for(; str > buff; str--, buff++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6177 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6178 *buff ^= *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6179 *str ^= *buff;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6180 *buff ^= *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6181 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6182 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6183
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6184
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6185 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6186 * Create a new bitmap button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6187 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6188 * text: Bubble help text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6189 * id: An ID of a bitmap in the resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6190 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6191 HWND API dw_bitmapbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6192 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6193 char idbuf[256], *name = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6194 HWND tmp;
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6195 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6196 HPOINTER icon = WinLoadPointer(HWND_DESKTOP, 0L, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6197
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6198 if(!icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6199 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6200 name = idbuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6201 _GenResIDStr(idbuf, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6202 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6203
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6204 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6205 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6206 (PSZ)name,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6207 WS_VISIBLE | BS_PUSHBUTTON |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6208 BS_NOPOINTERFOCUS | BS_AUTOSIZE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6209 (icon ? 0 : BS_BITMAP),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6210 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6211 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6212 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6213 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6214 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6215 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6216
1397
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6217 if(text)
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6218 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
6219 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
6220
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6221 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6222
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6223 if(icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6224 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
6225 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6226 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6227 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6228
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6229 /*
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6230 * 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
6231 * Parameters:
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6232 * 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
6233 * 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
6234 * 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
6235 * 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
6236 * (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
6237 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
6238 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
6239 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6240 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
6241 HWND tmp = WinCreateWindow(HWND_OBJECT,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6242 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6243 NULL,
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6244 WS_VISIBLE | BS_PUSHBUTTON |
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6245 BS_AUTOSIZE | BS_NOPOINTERFOCUS,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6246 0,0,2000,1000,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6247 NULLHANDLE,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6248 HWND_TOP,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6249 id,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6250 NULL,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6251 NULL);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6252 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6253 HPIXMAP pixmap = NULL, disabled = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6254 HPOINTER icon = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6255
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6256 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
6257 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6258 int z, j, lim, len;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6259 LONG fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6260
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6261 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6262
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6263 /* 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
6264 if(access(file, 04) == 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6265 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6266 len = strlen( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6267 if(len > 4)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6268 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6269 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
6270 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6271 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6272 _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
6273 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6274 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6275 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6276 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6277 /* Try with .ico extension first...*/
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6278 strcat(file, ".ico");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6279 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
6280 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6281 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6282 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6283 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6284 strcat(file, ".bmp");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6285 if(access(file, 04) == 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6286 _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
6287 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6288 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6289
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6290 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6291 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6292 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6293 pixmap = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6294 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6295 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6296 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6297 /* Create a disabled style pixmap */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6298 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
6299 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
6300
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6301 fore = _foreground;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6302 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
6303 lim = pixmap->width/2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6304 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
6305 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6306 int mod = j%2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6307
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6308 for(z=0;z<lim;z++)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6309 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
6310 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6311 _foreground = fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6312 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6313 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6314
1397
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6315 if(text)
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6316 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
6317 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6318
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6319 WinSetWindowPtr(tmp, QWP_USER, blah);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6320
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6321 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6322 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
6323 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6324 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6325 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
6326 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
6327 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6328 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
6329 return tmp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6330 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6331
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6332 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6333 * 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
6334 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6335 * 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
6336 * 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
6337 * data: The contents of the image
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6338 * (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
6339 * len: length of str
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6340 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6341 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
6342 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6343 FILE *fp;
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6344 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
6345 HWND tmp = WinCreateWindow(HWND_OBJECT,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6346 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6347 NULL,
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6348 WS_VISIBLE | BS_PUSHBUTTON |
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6349 BS_AUTOSIZE | BS_NOPOINTERFOCUS,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6350 0,0,2000,1000,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6351 NULLHANDLE,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6352 HWND_TOP,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6353 id,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6354 NULL,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6355 NULL);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6356 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6357 HPIXMAP pixmap = NULL, disabled = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6358 HPOINTER icon = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6359
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6360 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
6361 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6362 int z, j, lim;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6363 LONG fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6364 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6365 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6366 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6367 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6368 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6369 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6370 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6371 fclose( fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6372 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
6373 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6374 _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
6375 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6376 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
6377 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6378 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6379 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6380 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6381 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6382 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6383 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6384 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6385 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6386 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6387 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6388
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6389 if ( icon )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6390 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6391 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6392 pixmap = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6393 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6394 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6395 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6396 /* Create a disabled style pixmap */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6397 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
6398 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
6399
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6400 fore = _foreground;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6401 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
6402 lim = pixmap->width/2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6403 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
6404 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6405 int mod = j%2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6406
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6407 for(z=0;z<lim;z++)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6408 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
6409 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6410 _foreground = fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6411 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6412 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6413
1397
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6414 if(text)
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6415 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
6416 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6417
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6418 WinSetWindowPtr(tmp, QWP_USER, blah);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6419
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6420 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6421 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
6422 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6423 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6424 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
6425 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
6426 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6427 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
6428 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
6429 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6430
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6431 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6432 * Create a new spinbutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6433 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6434 * 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
6435 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6436 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6437 HWND API dw_spinbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6438 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6439 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6440 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6441 WC_SPINBUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6442 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6443 WS_VISIBLE | SPBS_MASTER,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6444 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6445 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6446 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6447 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6448 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6449 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6450 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
6451 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
6452 WinSendMsg(tmp, SPBM_SETCURRENTVALUE, MPFROMLONG(atoi(text)), 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6453 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6454 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6455 blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6456 blah->oldproc = WinSubclassWindow(entry, _spinentryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6457 WinSetWindowPtr(entry, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6458 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6459 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
6460 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
6461 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6462 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6463
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6464 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6465 * Create a new radiobutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6466 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6467 * 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
6468 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6469 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6470 HWND API dw_radiobutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6471 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6472 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6473 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6474 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6475 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6476 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6477 BS_AUTORADIOBUTTON,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6478 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6479 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6480 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6481 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6482 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6483 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6484 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6485 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6486 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
6487 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
6488 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6489 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6490
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
6491
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6492 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6493 * 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
6494 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6495 * 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
6496 * 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
6497 * 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
6498 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6499 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
6500 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6501 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6502 SLDCDATA sldcData = { 0, 0, 0, 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6503 HWND tmp;
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 sldcData.cbSize = sizeof(SLDCDATA);
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
6506 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
6507
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6508 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6509 WC_SLIDER,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6510 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6511 WS_VISIBLE | SLS_SNAPTOINCREMENT |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6512 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6513 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6514 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6515 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
6516 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6517 &sldcData,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6518 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6519
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6520 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6521 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6522 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
6523 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6524
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6525 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6526 * 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
6527 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6528 * 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
6529 * 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
6530 * 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
6531 */
511
80dbd5a1f403 Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 510
diff changeset
6532 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
6533 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6534 return WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6535 WC_SCROLLBAR,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6536 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6537 WS_VISIBLE | SBS_AUTOTRACK |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6538 (vertical ? SBS_VERT : SBS_HORZ),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6539 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6540 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6541 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
6542 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6543 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6544 NULL);
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6545 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6546
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6547 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
6548 * Create a new percent bar window (widget) to be packed.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6549 * 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
6550 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6551 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6552 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
6553 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6554 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6555 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6556 WC_SLIDER,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6557 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6558 WS_VISIBLE | SLS_READONLY
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6559 | SLS_RIBBONSTRIP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6560 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6561 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6562 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
6563 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6564 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6565 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6566 blah->oldproc = WinSubclassWindow(tmp, _percentproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6567 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6568 dw_window_disable(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6569 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6570 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6571
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6572 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6573 * Create a new checkbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6574 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6575 * 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
6576 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6577 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6578 HWND API dw_checkbox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6579 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6580 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6581 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6582 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6583 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6584 WS_VISIBLE | BS_AUTOCHECKBOX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6585 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6586 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6587 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6588 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6589 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6590 NULL);
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6591 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6592 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6593 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
6594 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
6595 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6596 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6597
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6598 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6599 * Create a new listbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6600 * 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
6601 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6602 * multi: Multiple select TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6603 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6604 HWND API dw_listbox_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6605 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6606 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6607 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6608 WC_LISTBOX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6609 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6610 WS_VISIBLE | LS_NOADJUSTPOS |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6611 (multi ? LS_MULTIPLESEL : 0),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6612 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6613 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6614 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
6615 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6616 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6617 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6618 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6619 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6620 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6621 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
6622 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6623 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6624
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6625 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6626 * Sets the icon used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6627 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6628 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6629 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6630 */
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
6631 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
6632 {
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
6633 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
6634 WinSendMsg(handle, WM_SETICON, (MPARAM)hptr, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6635 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6636
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6637 /* 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
6638 * 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
6639 */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6640 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
6641 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6642 HFILE BitmapFileHandle = NULLHANDLE; /* handle for the file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6643 ULONG OpenAction = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6644 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
6645 FILESTATUS BitmapStatus;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6646 ULONG cbRead;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6647 PBITMAPFILEHEADER2 pBitmapFileHeader;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6648 PBITMAPINFOHEADER2 pBitmapInfoHeader;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6649 ULONG ScanLines, ulFlags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6650 HPS hps1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6651 HDC hdc1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6652 SIZEL sizl = { 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6653
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6654 /* open bitmap file */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6655 DosOpen((PSZ)file, &BitmapFileHandle, &OpenAction, 0L,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6656 FILE_ARCHIVED | FILE_NORMAL | FILE_READONLY,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6657 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
6658 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6659 OPEN_FLAGS_NOINHERIT, 0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6660
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6661 if(!BitmapFileHandle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6662 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6663
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6664 /* find out how big the file is */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6665 DosQueryFileInfo(BitmapFileHandle, 1, &BitmapStatus,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6666 sizeof(BitmapStatus));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6667
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6668 /* allocate memory to load the bitmap */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6669 DosAllocMem((PPVOID)&BitmapFileBegin, (ULONG)BitmapStatus.cbFile,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6670 PAG_READ | PAG_WRITE | PAG_COMMIT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6671
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6672 /* read bitmap file into memory buffer */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6673 DosRead(BitmapFileHandle, (PVOID)BitmapFileBegin,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6674 BitmapStatus.cbFile, &cbRead);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6675
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6676 /* access first bytes as bitmap header */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6677 pBitmapFileHeader = (PBITMAPFILEHEADER2)BitmapFileBegin;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6678
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6679 /* check if it's a valid bitmap data file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6680 if((pBitmapFileHeader->usType != BFT_BITMAPARRAY) &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6681 (pBitmapFileHeader->usType != BFT_BMAP))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6682 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6683 /* free memory of bitmap file buffer */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6684 DosFreeMem(BitmapFileBegin);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6685 /* close the bitmap file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6686 DosClose(BitmapFileHandle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6687 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6688 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6689
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6690 /* check if it's a file with multiple bitmaps */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6691 if(pBitmapFileHeader->usType == BFT_BITMAPARRAY)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6692 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6693 /* 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
6694 pBitmapFileHeader = &(((PBITMAPARRAYFILEHEADER2)BitmapFileBegin)->bfh2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6695 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6696
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6697 /* set pointer to bitmap information block */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6698 pBitmapInfoHeader = &pBitmapFileHeader->bmp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6699
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6700 /* 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
6701 /* and query number of lines */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6702 if(pBitmapInfoHeader->cbFix == sizeof(BITMAPINFOHEADER))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6703 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6704 *height = ScanLines = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6705 *width = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6706 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6707 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6708 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6709 *height = ScanLines = pBitmapInfoHeader->cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6710 *width = pBitmapInfoHeader->cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6711 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6712
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6713 /* 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
6714 hps1 = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6715
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6716 hdc1 = GpiQueryDevice(hps1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6717 ulFlags = GpiQueryPS(hps1, &sizl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6718
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6719 *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
6720 *hps = GpiCreatePS (dwhab, *hdc, &sizl, ulFlags | GPIA_ASSOC);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6721
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6722 /* 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
6723 *hbm = GpiCreateBitmap(*hps, pBitmapInfoHeader, 0L, NULL, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6724
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6725 /* select the new bitmap into presentation space */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6726 GpiSetBitmap(*hps, *hbm);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6727
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6728 /* now copy the bitmap data into the bitmap */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6729 GpiSetBitmapBits(*hps, 0L, ScanLines,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6730 BitmapFileBegin + pBitmapFileHeader->offBits,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6731 (PBITMAPINFO2)pBitmapInfoHeader);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6732
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6733 WinReleasePS(hps1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6734
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6735 /* free memory of bitmap file buffer */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6736 DosFreeMem(BitmapFileBegin);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6737 /* close the bitmap file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6738 DosClose(BitmapFileHandle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6739 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
6740 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6741
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6742 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6743 * Sets the bitmap used for a given static window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6744 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6745 * 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
6746 * 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
6747 * (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
6748 * 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
6749 * 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
6750 * 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
6751 */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6752 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6753 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6754 HBITMAP hbm;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6755 HPS hps;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6756
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6757 /* Destroy any old bitmap data */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6758 _free_bitmap(handle);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6759
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6760 /* 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
6761 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6762 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6763 hps = WinGetPS( handle );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6764 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
6765 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6766 else if ( filename )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6767 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6768 HDC hdc;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6769 unsigned long width, height;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6770 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6771
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6772 if(!file)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6773 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6774
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6775 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6776
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6777 /* 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
6778 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6779 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6780 /* Try with .bmp extention */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6781 strcat(file, ".bmp");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6782 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6783 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6784 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6785
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6786 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
6787 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6788
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6789 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
6790 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
6791 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
6792 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
6793 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6794 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6795 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6796
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6797 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
6798 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
6799 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6800 WinReleasePS(hps);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6801 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
6802
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
6803 /* 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
6804 {
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
6805 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
6806
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
6807 /* 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
6808 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
6809 {
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
6810 _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
6811 /* 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
6812 _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
6813 }
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
6814 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6815 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6816
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6817 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6818 * 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
6819 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6820 * handle: Handle to the window.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6821 * 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
6822 * (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
6823 * 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
6824 * 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
6825 * 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
6826 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6827 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
6828 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6829 HBITMAP hbm;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6830 HPS hps;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6831 HDC hdc;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6832 unsigned long width, height;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6833 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6834 FILE *fp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6835
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6836 /* Destroy any old bitmap data */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6837 _free_bitmap(handle);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6838
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6839 /* 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
6840 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6841 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6842 hps = WinGetPS( handle );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6843 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
6844 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6845 else if ( data )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6846 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6847 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6848 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6849 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6850 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6851 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6852 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6853 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6854 fclose( fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6855 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
6856 _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
6857 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
6858 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6859 /* con't use ICO ? */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6860 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6861 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6862 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6863 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6864 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6865 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6866 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6867 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6868 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6869 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6870 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6871
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6872 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
6873 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
6874 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
6875 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
6876 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6877 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6878 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6879
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6880 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
6881 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
6882 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6883 WinReleasePS(hps);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6884 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6885 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6886
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6887 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6888 * Sets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6889 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6890 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6891 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6892 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6893 void API dw_window_set_text(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6894 {
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
6895 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
6896 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
6897 /* 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
6898 {
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
6899 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
6900
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
6901 /* 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
6902 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
6903 {
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
6904 _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
6905 /* 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
6906 _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
6907 }
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
6908 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6909 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6910
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6911 /*
1389
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6912 * 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
6913 * Parameters:
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6914 * 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
6915 * 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
6916 */
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6917 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
6918 {
1398
152e3c8916de Set tooltip on the entryfield part of a combobox...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1397
diff changeset
6919 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
6920 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
6921 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
6922
152e3c8916de Set tooltip on the entryfield part of a combobox...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1397
diff changeset
6923 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
6924
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
6925 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
6926 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
6927 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
6928 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
6929 }
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6930
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6931 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6932 * Gets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6933 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6934 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6935 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6936 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6937 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6938 char * API dw_window_get_text(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6939 {
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
6940 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
6941 int len = WinQueryWindowTextLength(entryfield ? entryfield : handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6942 char *tempbuf = calloc(1, len + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6943
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6944 WinQueryWindowText(entryfield ? entryfield : handle, len + 1, (PSZ)tempbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6945
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6946 return tempbuf;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6947 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6948
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6949 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6950 * Disables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6951 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6952 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6953 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6954 void API dw_window_disable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6955 {
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
6956 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6957
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
6958 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
6959 {
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
6960 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
6961 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
6962
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
6963 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
6964 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
6965
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
6966 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
6967 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
6968 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
6969 }
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
6970
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6971 if(dw_window_get_data(handle, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6972 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6973
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6974 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6975 dw_window_set_data(handle, "_dw_disabled", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6976
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6977 if(tmpbuf[0] == '#')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6978 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6979 int val = atoi(&tmpbuf[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6980 HWND hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6981
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6982 switch(val)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6983 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6984 case 2:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6985 case 6:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6986 case 10:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6987 case 32:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6988 case 7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6989 hwnd = _find_entryfield(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6990 _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
6991 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
6992 if(val == 2)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6993 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
6994 if(hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6995 dw_window_set_data(hwnd, "_dw_disabled", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6996 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6997 case 3:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6998 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
6999 WinEnableWindow(handle, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7000 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
7001 WinInvalidateRect(handle, NULL, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7002 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7003 _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
7004 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
7005 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
7006 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7007 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7008 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7009 WinEnableWindow(handle, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7010 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7011
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7012 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7013 * Enables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7014 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7015 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7016 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7017 void API dw_window_enable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7018 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7019 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
7020 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
7021 HWND hwnd = _find_entryfield(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7022
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
7023 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
7024 {
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
7025 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
7026 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
7027
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
7028 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
7029 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
7030
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
7031 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
7032 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
7033 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
7034 }
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
7035
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7036 dw_window_set_data(handle, "_dw_disabled", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7037 if(hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7038 dw_window_set_data(hwnd, "_dw_disabled", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7039 if(fore && back)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7040 _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
7041 dw_signal_disconnect_by_data(handle, (void *)100);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7042 WinEnableWindow(handle, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7043 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
7044 WinInvalidateRect(handle, NULL, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7045 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7046
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7047 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7048 * Gets the child window handle with specified ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7049 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7050 * handle: Handle to the parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7051 * id: Integer ID of the child.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7052 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7053 HWND API dw_window_from_id(HWND handle, int id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7054 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7055 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7056 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
7057 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7058
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7059 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7060 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7061 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7062 int windowid = WinQueryWindowUShort(child, QWS_ID);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7063 HWND found;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7064
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7065 WinQueryClassName(child, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7066
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7067 /* 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
7068 if(strncmp(tmpbuf, "#1", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7069 if((found = dw_window_from_id(child, id)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7070 return found;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7071
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7072 if(windowid && windowid == id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7073 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7074 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7075 return child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7076 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7077 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7078 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7079 return NULLHANDLE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7080 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7081
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
7082 /* 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
7083 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
7084 {
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
7085 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
7086
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
7087 /*
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
7088 * 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
7089 * 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
7090 */
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
7091 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
7092 {
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
7093 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
7094 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
7095 }
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
7096
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
7097 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
7098 {
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
7099 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
7100 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
7101 {
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
7102 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
7103 }
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
7104 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
7105 {
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
7106 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
7107 }
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
7108 }
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
7109
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
7110 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
7111
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
7112 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
7113 {
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
7114 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
7115 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
7116 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
7117 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
7118
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
7119 /* 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
7120 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
7121 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
7122 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
7123 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
7124
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
7125 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
7126
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
7127 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
7128 {
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
7129 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
7130 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
7131 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
7132 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
7133 }
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
7134
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
7135
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7136 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
7137
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
7138 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
7139 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
7140 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
7141 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
7142
1645
69386c5a8e3e Fixed render widgets being incorrectly identified as boxes on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1642
diff changeset
7143 if(strncmp(tmpbuf, "#1", 3)==0 && !dw_window_get_data(item, "_dw_render"))
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
7144 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
7145 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
7146 {
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
7147 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
7148 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
7149 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
7150 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
7151
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
7152 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
7153 }
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
7154
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
7155 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
7156 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
7157 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
7158 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
7159 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
7160 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
7161
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
7162 /* 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
7163 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
7164 _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
7165
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
7166 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
7167
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
7168 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
7169 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
7170
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
7171 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
7172
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7173 WinQueryClassName(item, 99, (PCH)tmpbuf);
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
7174 /* Don't set the ownership if it's an entryfield
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
7175 * NOTE: spinbutton used to be in this list but it was preventing value change events
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
7176 * from firing, so I removed it. If spinbuttons cause problems revisit this.
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
7177 */
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
7178 if(strncmp(tmpbuf, "#6", 3)!=0 && /*strncmp(tmpbuf, "#32", 4)!=0 &&*/ strncmp(tmpbuf, "#2", 3)!=0)
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
7179 WinSetOwner(item, box);
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
7180 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
7181 _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
7182 /* 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
7183 _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
7184 }
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
7185 }
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
7186
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
7187 /*
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
7188 * 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
7189 * 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
7190 * 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
7191 * 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
7192 * 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
7193 * 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
7194 * 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
7195 * 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
7196 * 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
7197 * 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
7198 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7199 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
7200 {
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7201 _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
7202 }
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7203
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7204 /*
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7205 * 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
7206 * 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
7207 * 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
7208 * 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
7209 * 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
7210 * 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
7211 * 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
7212 * 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
7213 * 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
7214 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7215 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
7216 {
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7217 /* 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
7218 * 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
7219 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7220 _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
7221 }
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7222
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7223 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7224 * Pack windows (widgets) into a box from the end (or bottom).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7225 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7226 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7227 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7228 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7229 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7230 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7231 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7232 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7233 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7234 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
7235 {
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
7236 _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
7237 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7238
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7239 /*
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
7240 * 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
7241 * 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
7242 */
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7243 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
7244 {
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7245 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
7246 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
7247
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7248 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
7249 {
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7250 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
7251 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
7252
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7253 /* 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
7254 _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
7255
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7256 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
7257 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
7258
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7259 /* 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
7260 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
7261
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7262 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
7263 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
7264 }
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7265 }
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7266
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7267 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7268 * Sets the size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7269 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7270 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7271 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7272 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7273 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7274 void API dw_window_set_size(HWND handle, ULONG width, ULONG height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7275 {
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
7276 /* 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
7277 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
7278 _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
7279
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
7280 /* 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
7281 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SIZE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7282 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7283
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7284 /*
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
7285 * 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
7286 * 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
7287 * 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
7288 * 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
7289 * 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
7290 */
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
7291 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
7292 {
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
7293 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
7294
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
7295 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
7296
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
7297 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
7298 {
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
7299 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
7300
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
7301 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
7302 {
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
7303 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
7304
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
7305 /* 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
7306 _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
7307
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
7308 /* 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
7309 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
7310 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
7311 }
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
7312 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
7313 {
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
7314 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
7315
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
7316 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
7317 {
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
7318 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
7319
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
7320 /* 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
7321 _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
7322
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
7323 /* 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
7324 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
7325 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
7326 }
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
7327 }
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
7328 }
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
7329 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
7330 _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
7331 }
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
7332
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
7333 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7334 * Returns the width of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7335 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7336 int API dw_screen_width(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7337 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7338 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7339 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7340
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7341 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7342 * Returns the height of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7343 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7344 int API dw_screen_height(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7345 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7346 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7347 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7348
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7349 /* 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
7350 unsigned long API dw_color_depth_get(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7351 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7352 HDC hdc = WinOpenWindowDC(HWND_DESKTOP);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7353 long colors;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7354
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7355 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7356 DevCloseDC(hdc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7357 return colors;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7358 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7359
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
7360 /*
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
7361 * 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
7362 * 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
7363 * 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
7364 * 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
7365 * 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
7366 * 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
7367 */
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
7368 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
7369 {
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
7370 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
7371 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
7372 }
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
7373
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7374 /* 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
7375 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
7376 {
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7377 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
7378 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
7379
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7380 /* 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
7381 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
7382 {
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7383 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
7384
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7385 /* 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
7386 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
7387 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
7388 /* 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
7389 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
7390 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
7391 /* 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
7392 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
7393 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
7394 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
7395 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
7396
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7397 /* 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
7398 *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
7399 *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
7400 }
1495
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7401 /* 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
7402 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
7403 {
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7404 RECTL rect;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7405
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7406 _WinQueryDesktopWorkArea(HWND_DESKTOP, &rect);
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7407
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7408 if(horz & DW_GRAV_OBSTACLES)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7409 {
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7410 if((horz & 0xf) == DW_GRAV_LEFT)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7411 *x += rect.xLeft;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7412 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
7413 *x -= dw_screen_width() - rect.xRight;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7414 }
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7415 if(vert & DW_GRAV_OBSTACLES)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7416 {
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7417 if((vert & 0xf) == DW_GRAV_BOTTOM)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7418 *y += rect.yBottom;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7419 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
7420 *y -= dw_screen_height() - rect.yTop;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7421 }
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7422 }
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7423 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7424
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7425 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7426 * Sets the position of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7427 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7428 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7429 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7430 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7431 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7432 void API dw_window_set_pos(HWND handle, LONG x, LONG y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7433 {
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7434 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
7435
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7436 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
7437 /* 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
7438 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
7439 {
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
7440 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
7441 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
7442 }
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7443 _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
7444 WinSetWindowPos(handle, NULLHANDLE, x, y, 0, 0, SWP_MOVE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7445 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7446
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7447 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7448 * Sets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7449 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7450 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7451 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7452 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7453 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7454 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7455 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7456 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
7457 {
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
7458 /* 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
7459 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
7460 _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
7461
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7462 _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
7463 /* 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
7464 WinSetWindowPos(handle, NULLHANDLE, x, y, width, height, SWP_MOVE | SWP_SIZE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7465 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7466
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7467 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7468 * Gets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7469 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7470 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7471 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7472 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7473 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7474 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7475 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7476 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
7477 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7478 SWP swp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7479 WinQueryWindowPos(handle, &swp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7480 if(x)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7481 *x = swp.x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7482 if(y)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7483 *y = _get_frame_height(handle) - (swp.y + swp.cy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7484 if(width)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7485 *width = swp.cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7486 if(height)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7487 *height = swp.cy;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7488 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7489
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7490 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7491 * Sets the style of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7492 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7493 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7494 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7495 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7496 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7497 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7498 {
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
7499 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
7500 {
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7501 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
7502 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
7503
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7504 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
7505 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
7506
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7507 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
7508 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
7509 }
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7510 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
7511 WinSetWindowBits(handle, QWL_STYLE, style, mask);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7512 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7513
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7514 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7515 * Adds a new page to specified notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7516 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7517 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7518 * flags: Any additional page creation flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7519 * front: If TRUE page is added at the beginning.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7520 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7521 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7522 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7523 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7524 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), front ? BKA_FIRST : BKA_LAST));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7525 }
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 * Remove a page from a notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7529 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7530 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7531 * pageid: ID of the page to be destroyed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7532 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7533 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7534 {
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
7535 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
7536 MPFROMLONG(pageid), 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7537 WinSendMsg(handle, BKM_DELETEPAGE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7538 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
7539 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
7540 dw_window_destroy(pagehwnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7541 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7542
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7543 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7544 * Queries the currently visible page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7545 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7546 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7547 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7548 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
7549 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7550 return (unsigned long)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7551 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7552
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7553 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7554 * Sets the currently visibale page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7555 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7556 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7557 * pageid: ID of the page to be made visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7558 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7559 void API dw_notebook_page_set(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7560 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7561 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7562 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7563
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7564 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7565 * Sets the text on the specified notebook tab.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7566 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7567 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7568 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7569 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7570 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7571 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7572 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7573 WinSendMsg(handle, BKM_SETTABTEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7574 MPFROMLONG(pageid), MPFROMP(text));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7575 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7576
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7577 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7578 * Sets the text on the specified notebook tab status area.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7579 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7580 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7581 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7582 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7583 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7584 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7585 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7586 WinSendMsg(handle, BKM_SETSTATUSLINETEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7587 MPFROMLONG(pageid), MPFROMP(text));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7588 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7589
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7590 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7591 * Packs the specified box into the notebook page.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7592 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7593 * handle: Handle to the notebook to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7594 * pageid: Page ID in the notebook which is being packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7595 * page: Box handle to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7596 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7597 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7598 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7599 HWND tmpbox = dw_box_new(DW_VERT, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7600
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7601 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
7602 WinSubclassWindow(tmpbox, _wndproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7603 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7604 MPFROMLONG(pageid), MPFROMHWND(tmpbox));
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 * Appends the specified text to the listbox's (or combobox) entry list.
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 listbox to be appended to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7611 * text: Text to append into listbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7612 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7613 void API dw_listbox_append(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7614 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7615 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7616 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7617 MPFROMSHORT(LIT_END),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7618 MPFROMP(text));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7619 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7620
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 * 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
7623 * Parameters:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7624 * handle: Handle to the listbox to be inserted into.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7625 * text: Text to insert into listbox.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7626 * pos: 0-based position to insert text
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7627 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7628 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
7629 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7630 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7631 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7632 MPFROMSHORT(pos),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7633 MPFROMP(text));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7634 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7635
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7636 /*
571
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7637 * 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
7638 * Parameters:
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7639 * 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
7640 * text: Text strings to append into listbox.
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7641 * count: Number of text strings to append
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7642 */
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7643 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
7644 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7645 int i;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7646 for(i=0;i<count;i++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7647 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7648 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7649 MPFROMSHORT(LIT_END),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7650 MPFROMP(text[i]));
571
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7651 }
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7652
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
7653 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7654 * Clears the listbox's (or combobox) list of all entries.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7655 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7656 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7657 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7658 void API dw_listbox_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7659 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7660 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7661 LM_DELETEALL, 0L, 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7662 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7663
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7664 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7665 * Returns the listbox's item count.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7666 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7667 * handle: Handle to the listbox to be cleared.
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 int API dw_listbox_count(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7670 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7671 return (int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7672 LM_QUERYITEMCOUNT,0L, 0L);
3
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7676 * Sets the topmost item in the viewport.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7677 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7678 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7679 * top: Index to the top item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7680 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7681 void API dw_listbox_set_top(HWND handle, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7682 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7683 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7684 LM_SETTOPINDEX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7685 MPFROMSHORT(top),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7686 0L);
3
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7690 * Copies the given index item's text into buffer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7691 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7692 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7693 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7694 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7695 * length: Length of the buffer (including NULL).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7696 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7697 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
7698 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7699 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7700 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7701
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7702 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7703 * Sets the text of a given listbox entry.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7704 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7705 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7706 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7707 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7708 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7709 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7710 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7711 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7712 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7713
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7714 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7715 * Returns the index to the item in the list currently selected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7716 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7717 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7718 */
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
7719 int API dw_listbox_selected(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7720 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7721 return (unsigned int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7722 LM_QUERYSELECTION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7723 MPFROMSHORT(LIT_CURSOR),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7724 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7725 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7726
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7727 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7728 * Returns the index to the current selected item or -1 when done.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7729 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7730 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7731 * where: Either the previous return or -1 to restart.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7732 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7733 int API dw_listbox_selected_multi(HWND handle, int where)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7734 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7735 int place = where;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7736
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7737 if(where == -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7738 place = LIT_FIRST;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7739
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7740 place = (int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7741 LM_QUERYSELECTION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7742 MPFROMSHORT(place),0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7743 if(place == LIT_NONE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7744 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7745 return place;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7746 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7747
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7748 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7749 * Sets the selection state of a given index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7750 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7751 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7752 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7753 * state: TRUE if selected FALSE if unselected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7754 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7755 void API dw_listbox_select(HWND handle, int index, int state)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7756 {
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
7757 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7758
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7759 WinSendMsg(handle, LM_SELECTITEM, MPFROMSHORT(index), (MPARAM)state);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7760
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7761 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7762
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7763 /* 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
7764 if(strncmp(tmpbuf, "#6", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7765 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7766 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7767
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7768 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7769 * Deletes the item with given index from the list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7770 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7771 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7772 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7773 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7774 void API dw_listbox_delete(HWND handle, int index)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7775 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7776 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7777 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7778
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7779 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7780 * Adds text to an MLE box and returns the current point.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7781 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7782 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7783 * buffer: Text buffer to be imported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7784 * startpoint: Point to start entering text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7785 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7786 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7787 {
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
7788 long point = startpoint < 0 ? 0 : startpoint;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7789 PBYTE mlebuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7790
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7791 /* Work around 64K limit */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7792 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
7793 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7794 int amount, len = strlen(buffer), written = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7795
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7796 while(written < len)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7797 {
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7798 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
7799
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7800 if((len - written) > 65535)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7801 amount = 65535;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7802 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7803 amount = len - written;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7804
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7805 /* 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
7806 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
7807 {
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7808 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
7809 {
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7810 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
7811 x++;
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7812 }
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7813 }
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7814
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7815 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
7816 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
7817 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
7818 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(x));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7819
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7820 written += amount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7821 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7822 DosFreeMem(mlebuf);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7823 }
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7824 return point;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7825 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7826
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7827 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7828 * Grabs text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7829 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7830 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7831 * buffer: Text buffer to be exported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7832 * startpoint: Point to start grabbing text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7833 * length: Amount of text to be grabbed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7834 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7835 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7836 {
1000
99907f19a703 Minor fixed and code cleanups on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 996
diff changeset
7837 PBYTE mlebuf;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7838
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7839 /* Work around 64K limit */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7840 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
7841 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7842 int amount, copied, written = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7843
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7844 while(written < length)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7845 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7846 if((length - written) > 65535)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7847 amount = 65535;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7848 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7849 amount = length - written;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7850
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7851 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7852 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
7853
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7854 if(copied)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7855 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7856 memcpy(&buffer[written], mlebuf, copied);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7857
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7858 written += copied;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7859 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7860 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7861 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7862 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7863 DosFreeMem(mlebuf);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7864 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7865 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7866
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7867 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7868 * Obtains information about an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7869 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7870 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7871 * bytes: A pointer to a variable to return the total bytes.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7872 * lines: A pointer to a variable to return the number of lines.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7873 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7874 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7875 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7876 if(bytes)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7877 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7878 if(lines)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7879 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7880 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7881
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7882 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7883 * Deletes text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7884 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7885 * handle: Handle to the MLE to be deleted from.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7886 * startpoint: Point to start deleting text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7887 * length: Amount of text to be deleted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7888 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7889 void API dw_mle_delete(HWND handle, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7890 {
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7891 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(length));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7892 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7893
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7894 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7895 * Clears all text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7896 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7897 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7898 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7899 void API dw_mle_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7900 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7901 unsigned long bytes;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7902
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7903 dw_mle_get_size(handle, &bytes, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7904
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7905 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7906 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7907
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7908 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7909 * Sets the visible line of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7910 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7911 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7912 * line: Line to be visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7913 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
7914 void API dw_mle_set_visible(HWND handle, int line)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7915 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7916 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
7917 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(tmppnt), MPFROMLONG(tmppnt));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7918 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7919
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7920 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7921 * Sets the editablity of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7922 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7923 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7924 * 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
7925 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
7926 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
7927 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7928 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
7929 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7930
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7931 /*
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7932 * Sets the word wrap state of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7933 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7934 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7935 * 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
7936 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
7937 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
7938 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7939 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7940 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7941
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7942 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7943 * Sets the current cursor position of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7944 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7945 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7946 * point: Point to position cursor.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7947 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7948 void API dw_mle_set_cursor(HWND handle, int point)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7949 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7950 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7951 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7952
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7953 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7954 * Finds text in an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7955 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7956 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7957 * text: Text to search for.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7958 * point: Start point of search.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7959 * flags: Search specific flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7960 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7961 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7962 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7963 MLE_SEARCHDATA msd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7964
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7965 /* 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
7966 * 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
7967 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7968 msd.cb = sizeof(msd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7969 msd.pchFind = text;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7970 msd.pchReplace = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7971 msd.cchFind = strlen(text);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7972 msd.cchReplace = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7973 msd.iptStart = point;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7974 msd.iptStop = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7975
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7976 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
7977 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
7978 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7979 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7980
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7981 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7982 * Stops redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7983 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7984 * handle: Handle to the MLE to freeze.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7985 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7986 void API dw_mle_freeze(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7987 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7988 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7989 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7990
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7991 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7992 * Resumes redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7993 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7994 * handle: Handle to the MLE to thaw.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7995 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7996 void API dw_mle_thaw(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7997 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7998 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7999 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8000
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8001 /* 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
8002 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
8003 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8004 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
8005
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8006 if(range)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8007 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8008 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
8009
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8010 if(mypos >= range)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8011 mypos = range - 1;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8012
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8013 _dw_int_set(handle, mypos);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8014 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
8015 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8016 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8017
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8018 /* 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
8019 void _percentthread(void *data)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8020 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8021 HWND percent = (HWND)data;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8022
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8023 if(percent)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8024 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8025 HAB thishab = WinInitialize(0);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8026 HMQ thishmq = WinCreateMsgQueue(dwhab, 0);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8027
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8028 int pos = 100;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8029
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8030 do
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8031 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8032 pos--;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8033 if(pos < 1)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8034 pos = 100;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8035 _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
8036 DosSleep(100);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8037 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8038 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
8039
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8040 WinDestroyMsgQueue(thishmq);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8041 WinTerminate(thishab);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8042 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8043 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8044
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8045 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
8046 * Sets the percent bar position.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8047 * 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
8048 * 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
8049 * position: Position of the percent bar withing the range.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8050 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8051 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
8052 {
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
8053 /* 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
8054 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
8055 {
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8056 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
8057 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8058 /* 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
8059 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
8060 _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
8061 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8062 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8063 else
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8064 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8065 /* 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
8066 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
8067 /* 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
8068 _dw_percent_set_pos(handle, position);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8069 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8070 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8071
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8072 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8073 * 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
8074 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8075 * 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
8076 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8077 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
8078 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8079 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
8080 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8081
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8082 /*
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8083 * 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
8084 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8085 * 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
8086 * 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
8087 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8088 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
8089 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8090 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
8091 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
8092 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8093
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8094 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8095 * 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
8096 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8097 * 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
8098 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8099 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
8100 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8101 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
8102 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8103
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8104 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8105 * 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
8106 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8107 * 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
8108 * 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
8109 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8110 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
8111 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8112 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
8113 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
8114 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8115
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8116 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8117 * 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
8118 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8119 * 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
8120 * 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
8121 * 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
8122 */
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
8123 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
8124 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8125 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
8126 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
8127 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
8128 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
8129 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8130
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8131 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8132 * Sets the spinbutton value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8133 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8134 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8135 * position: Current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8136 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8137 void API dw_spinbutton_set_pos(HWND handle, long position)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8138 {
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
8139 dw_window_set_data(handle, "_dw_updating", (void *)1);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8140 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L);
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
8141 dw_window_set_data(handle, "_dw_updating", NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8142 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8143
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8144 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8145 * Sets the spinbutton limits.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8146 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8147 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8148 * upper: Upper limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8149 * lower: Lower limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8150 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8151 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8152 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8153 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8154 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8155
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8156 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8157 * Sets the entryfield character limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8158 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8159 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8160 * limit: Number of characters the entryfield will take.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8161 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8162 void API dw_entryfield_set_limit(HWND handle, ULONG limit)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8163 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8164 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8165 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8166
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8167
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8168 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8169 * Returns the current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8170 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8171 * handle: Handle to the spinbutton to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8172 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8173 long API dw_spinbutton_get_pos(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8174 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8175 long tmpval = 0L;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8176
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8177 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
8178 return tmpval;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8179 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8180
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8181 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8182 * Returns the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8183 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8184 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8185 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8186 int API dw_checkbox_get(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8187 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8188 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8189 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8190
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8191 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8192 * Sets the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8193 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8194 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8195 * value: TRUE for checked, FALSE for unchecked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8196 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8197 void API dw_checkbox_set(HWND handle, int value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8198 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8199 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8200 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8201
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8202 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8203 * 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
8204 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8205 * 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
8206 * 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
8207 * 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
8208 * 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
8209 * 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
8210 * 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
8211 */
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
8212 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
8213 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8214 ULONG cbExtra;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8215 PCNRITEM pci;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8216 RECORDINSERT ri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8217
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8218 if(!item)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8219 item = (HTREEITEM)CMA_FIRST;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8220
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8221 /* 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
8222 * MINIRECORDCORE structure
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8223 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8224
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8225 cbExtra = sizeof(CNRITEM) - sizeof(MINIRECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8226
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8227 /* Allocate memory for the parent record */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8228
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8229 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
8230 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8231
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8232 /* Fill in the parent record data */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8233
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8234 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
8235 pci->rc.pszIcon = (PSZ)strdup(title);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8236 pci->rc.hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8237
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8238 pci->hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8239 pci->user = itemdata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8240 pci->parent = parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8241
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8242 memset(&ri, 0, sizeof(RECORDINSERT));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8243
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8244 ri.cb = sizeof(RECORDINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8245 ri.pRecordOrder = (PRECORDCORE)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8246 ri.zOrder = (USHORT)CMA_TOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8247 ri.cRecordsInsert = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8248 ri.fInvalidateRecord = TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8249
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8250 /* 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
8251 * the one we just inserted.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8252 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8253 ri.pRecordParent = (PRECORDCORE)parent;
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 /* Insert the record */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8256 WinSendMsg(handle, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri));
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 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
8259 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8260
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8261 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8262 * 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
8263 * Parameters:
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8264 * 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
8265 * title: The text title of the entry.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8266 * icon: Handle to coresponding icon.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8267 * parent: Parent handle or 0 if root.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8268 * itemdata: Item specific data.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8269 */
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
8270 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
8271 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8272 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
8273 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8274
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8275 /*
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
8276 * 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
8277 * 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
8278 * 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
8279 * 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
8280 * 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
8281 * 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
8282 */
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
8283 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
8284 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8285 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8286
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8287 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8288 return;
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 if(pci->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8291 free(pci->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8292
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8293 pci->rc.pszIcon = (PSZ)strdup(title);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8294 pci->rc.hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8295
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8296 pci->hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8297
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8298 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
8299 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8300
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8301 /*
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
8302 * 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
8303 * 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
8304 * 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
8305 * 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
8306 */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8307 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
8308 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8309 PCNRITEM pci = (PCNRITEM)item;
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 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8312 if(pci)
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8313 return (char *)pci->rc.pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8314 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
8315 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8316
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8317 /*
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8318 * 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
8319 * 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
8320 * 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
8321 * 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
8322 */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8323 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
8324 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8325 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8326
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8327 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8328 if(pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8329 return pci->parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8330 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
8331 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8332
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8333 /*
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
8334 * 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
8335 * 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
8336 * 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
8337 * 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
8338 * 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
8339 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
8340 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
8341 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8342 PCNRITEM pci = (PCNRITEM)item;
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 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8345 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8346 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8347
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8348 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
8349 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8350
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8351 /*
317
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8352 * 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
8353 * Parameters:
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8354 * 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
8355 * 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
8356 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8357 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
8358 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8359 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8360
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8361 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8362 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8363 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8364 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
8365 }
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8366
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8367 /*
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
8368 * 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
8369 * 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
8370 * 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
8371 * 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
8372 */
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
8373 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
8374 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8375 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
8376
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8377 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8378 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8379 if(pCore->flRecordAttr & CRA_SELECTED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8380 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
8381 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
8382 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8383 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
8384 lastitem = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8385 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
8386 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8387
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8388 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8389 * Removes all nodes from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8390 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8391 * 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
8392 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8393 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
8394 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8395 dw_container_clear(handle, TRUE);
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8396 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8397
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8398 /*
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
8399 * 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
8400 * 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
8401 * 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
8402 * 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
8403 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8404 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
8405 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8406 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
8407 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8408
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8409 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8410 * 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
8411 * 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
8412 * 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
8413 * 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
8414 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8415 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
8416 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8417 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
8418 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8419
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8420 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8421 * Removes a node from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8422 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8423 * 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
8424 * item: Handle to node to be deleted.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8425 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8426 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
8427 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8428 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8429
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8430 if(!item)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8431 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8432
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8433 if(pci->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8434 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8435 free(pci->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8436 pci->rc.pszIcon = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8437 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8438
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8439 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
8440 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8441
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8442 /* 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
8443 typedef struct _containerinfo {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8444 int count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8445 void *data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8446 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
8447 } ContainerInfo;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8448
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8449 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8450 * Sets up the container columns.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8451 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8452 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8453 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8454 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8455 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8456 * separator: The column number that contains the main separator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8457 * (this item may only be used in OS/2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8458 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8459 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
8460 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8461 PFIELDINFO details, first, left = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8462 FIELDINFOINSERT detin;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8463 CNRINFO cnri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8464 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8465 ULONG size = sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8466 ULONG *offStruct = malloc(count * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8467 ULONG *tempflags = malloc((count+1) * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8468 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8469 ULONG *oldflags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8470
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8471 if(!offStruct || !tempflags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8472 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8473
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8474 memcpy(tempflags, flags, count * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8475 tempflags[count] = 0;
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 blah->data = tempflags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8478 blah->flags = separator;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8479
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8480 if(oldflags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8481 free(oldflags);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8482
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8483 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
8484 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8485 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
8486 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8487
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8488 /* 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
8489 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8490 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8491 offStruct[z] = size;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8492 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8493 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8494 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8495 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8496 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8497 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8498 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8499 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8500 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8501 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8502 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8503
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8504 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
8505
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8506 if(!first)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8507 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8508 free(offStruct);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8509 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8510 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8511
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8512 for(z=0;z<count;z++)
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(z==separator-1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8515 left=details;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8516 details->cb = sizeof(FIELDINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8517 details->flData = flags[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8518 details->flTitle = CFA_FITITLEREADONLY;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8519 details->pTitleData = titles[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8520 details->offStruct = offStruct[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8521 details = details->pNextFieldInfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8522 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8523
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8524 detin.cb = sizeof(FIELDINFOINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8525 detin.fInvalidateFieldInfo = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8526 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8527 detin.cFieldInfoInsert = (ULONG)count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8528
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8529 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8530
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8531 if(count > separator && separator > 0)
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 cnri.cb = sizeof(CNRINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8534 cnri.pFieldInfoLast = left;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8535 cnri.xVertSplitbar = 150;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8536
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8537 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
8538 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8539
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8540 cnri.flWindowAttr = CV_DETAIL | CV_MINI | CA_DETAILSVIEWTITLES;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8541 cnri.slBitmapOrIcon.cx = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8542 cnri.slBitmapOrIcon.cy = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8543
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8544 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
8545
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8546 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
8547 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8548 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8549
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8550 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8551 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8552 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8553 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8554 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8555 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8556 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8557 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8558 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8559 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8560 char **newtitles = malloc(sizeof(char *) * (count + 2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8561 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8562
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8563 newtitles[0] = "Icon";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8564 newtitles[1] = "Filename";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8565
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8566 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
8567 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
8568
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8569 memcpy(&newtitles[2], titles, sizeof(char *) * count);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8570 memcpy(&newflags[2], flags, sizeof(unsigned long) * count);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8571
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8572 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
8573
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8574 free(newtitles);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8575 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
8576 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8577 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8578
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8579 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8580 * Obtains an icon from a module (or header in GTK).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8581 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8582 * module: Handle to module (DLL) in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8583 * id: A unsigned long id int the resources on OS/2 and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8584 * Windows, on GTK this is converted to a pointer
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8585 * to an embedded XPM.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8586 */
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
8587 HICN API dw_icon_load(unsigned long module, unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8588 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8589 return WinLoadPointer(HWND_DESKTOP,module,id);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8590 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8591
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8592 /*
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
8593 * 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
8594 * 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
8595 * 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
8596 * 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
8597 * (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
8598 */
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
8599 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
8600 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8601 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8602
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8603 if(!file)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8604 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8605
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8606 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8607
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8608 /* 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
8609 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8610 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8611 /* Try with .bmp extention */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8612 strcat(file, ".ico");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8613 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8614 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8615 }
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8616 return WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8617 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8618
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8619 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8620 * Obtains an icon from data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8621 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8622 * 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
8623 * DW pick the appropriate file extension.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8624 * (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
8625 */
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
8626 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
8627 {
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
8628 HICN icon=0;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8629 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8630 FILE *fp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8631
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8632 if ( !data )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8633 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8634 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8635 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8636 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8637 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8638 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8639 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8640 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8641 fclose( fp );
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8642 icon = WinLoadFileIcon( (PSZ)file, FALSE );
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8643 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8644 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8645 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8646 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8647 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8648 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8649 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8650 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8651 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
8652 }
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
8653
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
8654 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8655 * Frees a loaded resource in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8656 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8657 * handle: Handle to icon returned by dw_icon_load().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8658 */
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
8659 void API dw_icon_free(HICN handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8660 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
8661 WinDestroyPointer(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8662 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8663
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8664 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8665 * Allocates memory used to populate a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8666 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8667 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8668 * rowcount: The number of items to be populated.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8669 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8670 void * API dw_container_alloc(HWND handle, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8671 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8672 WindowData *wd = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8673 ULONG *flags = wd ? wd->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8674 int z, size = 0, totalsize, count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8675 PRECORDCORE temp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8676 ContainerInfo *ci;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8677 void *blah = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8678
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8679 if(!flags || rowcount < 1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8680 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8681
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8682 while(flags[count])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8683 count++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8684
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8685 /* 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
8686 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8687 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8688 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8689 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8690 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8691 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8692 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8693 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8694 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8695 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8696 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8697 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8698 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8699
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8700 totalsize = size + sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8701
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8702 z = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8703
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8704 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
8705 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8706
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8707 temp = (PRECORDCORE)blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8708
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8709 for(z=0;z<rowcount;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8710 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8711 temp->cb = totalsize;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8712 temp = temp->preccNextRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8713 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8714
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8715 ci = malloc(sizeof(struct _containerinfo));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8716
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8717 ci->count = rowcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8718 ci->data = blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8719 ci->handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8720
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8721 return (void *)ci;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8722 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8723
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8724 /* 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
8725 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
8726 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8727 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8728 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8729 int z, currentcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8730 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
8731 void *dest;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8732
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8733 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8734 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8735
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8736 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
8737 return;
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 currentcount = cnr.cRecords;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8740
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8741 /* 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
8742 for(z=0;z<column;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8743 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8744 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8745 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8746 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8747 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8748 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8749 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8750 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8751 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8752 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8753 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8754 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8755
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8756 totalsize = size + sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8757
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8758 for(z=0;z<(row-currentcount);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8759 temp = temp->preccNextRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8760
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8761 dest = (void *)(((ULONG)temp)+((ULONG)totalsize));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8762
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8763 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
8764 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8765 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
8766 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
8767 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8768 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
8769 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8770 else if(flags[column] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8771 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8772 char **newstr = (char **)data, **str = dest;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8773
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8774 if(*str)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8775 free(*str);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8776
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8777 if(newstr && *newstr)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8778 *str = strdup(*newstr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8779 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8780 *str = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8781 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8782 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
8783 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8784 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
8785 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
8786 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8787 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
8788 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8789 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
8790 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8791 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
8792 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
8793 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8794 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
8795 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8796 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
8797 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8798 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
8799 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
8800 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
8801 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
8802 }
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
8803 }
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
8804
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
8805 /* 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
8806 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
8807 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8808 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8809 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8810 int z, count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8811
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8812 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8813 return;
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 while(flags[count])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8816 count++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8817
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8818 /* 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
8819 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8820 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8821 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8822 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8823 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8824 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8825 char **str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8826
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8827 totalsize = size + sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8828
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8829 str = (char **)(((ULONG)temp)+((ULONG)totalsize));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8830
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8831 if(*str)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8832 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8833 free(*str);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8834 *str = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8835 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8836 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8837 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8838 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8839 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8840 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8841 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8842 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8843 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8844 }
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
8845 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
8846
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8847 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8848 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8849 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8850 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8851 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8852 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8853 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8854 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8855 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8856 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
8857 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8858 ContainerInfo *ci = (ContainerInfo *)pointer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8859
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8860 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8861 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8862
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8863 _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
8864 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8865
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8866 /*
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8867 * 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
8868 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8869 * 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
8870 * 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
8871 * 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
8872 * 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
8873 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8874 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
8875 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8876 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
8877 int count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8878
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8879 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8880 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8881 if(count == row)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8882 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8883 _dw_container_set_item(handle, pCore, column, 0, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8884 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
8885 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8886 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8887 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
8888 count++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8889 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8890 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8891
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8892 /*
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8893 * 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
8894 * Parameters:
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8895 * 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
8896 * 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
8897 * 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
8898 * 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
8899 */
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8900 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
8901 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8902 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
8903 }
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8904
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8905 /*
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8906 * 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
8907 * Parameters:
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8908 * 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
8909 * 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
8910 * 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
8911 * 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
8912 * 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
8913 */
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
8914 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
8915 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8916 dw_container_change_item(handle, 0, row, (void *)&icon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8917 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
8918 }
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8919
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8920 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8921 * 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
8922 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8923 * 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
8924 * 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
8925 * 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
8926 * 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
8927 * 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
8928 */
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
8929 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
8930 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8931 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
8932 dw_container_set_item(handle, pointer, 1, row, (void *)&filename);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8933 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8934
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8935 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8936 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8937 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8938 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8939 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8940 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8941 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8942 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8943 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8944 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
8945 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8946 dw_container_set_item(handle, pointer, column + 2, row, data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8947 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8948
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8949 /*
508
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8950 * 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
8951 * Parameters:
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8952 * 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
8953 * 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
8954 */
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8955 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
8956 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8957 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8958 ULONG *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8959 int rc;
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 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8962 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8963
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8964 if(flags[column] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8965 rc = DW_CFA_BITMAPORICON;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8966 else if(flags[column] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8967 rc = DW_CFA_STRING;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8968 else if(flags[column] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8969 rc = DW_CFA_ULONG;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8970 else if(flags[column] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8971 rc = DW_CFA_DATE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8972 else if(flags[column] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8973 rc = DW_CFA_TIME;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8974 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8975 rc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8976 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
8977 }
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8978
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8979 /*
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8980 * 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
8981 * Parameters:
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8982 * 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
8983 * 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
8984 */
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8985 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
8986 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8987 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
8988 }
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8989
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8990 /*
1208
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8991 * 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
8992 * Parameters:
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8993 * 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
8994 * 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
8995 * 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
8996 * 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
8997 * 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
8998 */
1291
b99b0b2c2826 Renamed dw_container_set_row_bg() to dw_container_set_stripe().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1290
diff changeset
8999 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
9000 {
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
9001 /* 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
9002 }
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
9003
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
9004 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9005 * 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
9006 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9007 * 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
9008 * 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
9009 * 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
9010 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9011 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
9012 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9013 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9014 column = column; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9015 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
9016 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9017
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9018 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9019 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9020 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9021 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9022 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9023 * title: String title of the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9024 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9025 void API dw_container_set_row_title(void *pointer, int row, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9026 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9027 ContainerInfo *ci = (ContainerInfo *)pointer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9028 PRECORDCORE temp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9029 int z, currentcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9030 CNRINFO cnr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9031
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9032 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9033 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9034
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9035 temp = (PRECORDCORE)ci->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9036
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9037 z = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9038
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9039 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
9040 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9041
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9042 currentcount = cnr.cRecords;
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 for(z=0;z<(row-currentcount);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9045 temp = temp->preccNextRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9046
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9047 temp->pszIcon = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9048 temp->pszName = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9049 temp->pszText = (PSZ)title;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9050 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9051
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9052 /*
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
9053 * 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
9054 * 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
9055 * 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
9056 * 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
9057 * 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
9058 */
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
9059 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
9060 {
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
9061 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
9062 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
9063
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
9064 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
9065 {
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
9066 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
9067 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9068 pCore->pszIcon = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9069 pCore->pszName = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9070 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
9071
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
9072 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
9073 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
9074 }
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
9075 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
9076 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
9077 }
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
9078 }
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
9079
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
9080 /* 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
9081 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
9082 {
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
9083 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
9084
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
9085 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
9086 {
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
9087 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
9088 {
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
9089 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
9090 {
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
9091 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
9092 }
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
9093 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
9094 }
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
9095 }
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
9096 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
9097 }
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
9098
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
9099 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9100 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9101 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9102 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9103 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9104 * rowcount: The number of rows to be inserted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9105 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9106 void API dw_container_insert(HWND handle, void *pointer, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9107 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9108 RECORDINSERT recin;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9109 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
9110 PRECORDCORE pCore;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9111
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9112 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9113 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9114
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9115 recin.cb = sizeof(RECORDINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9116 recin.pRecordOrder = (PRECORDCORE)CMA_END;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9117 recin.pRecordParent = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9118 recin.zOrder = CMA_TOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9119 recin.fInvalidateRecord = TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9120 recin.cRecordsInsert = rowcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9121
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9122 _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
9123
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9124 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
9125
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
9126 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
9127 {
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
9128 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
9129
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
9130 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
9131 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
9132 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
9133 _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
9134 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
9135 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9136 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9137
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9138 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9139 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9140 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9141 * 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
9142 * 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
9143 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9144 void API dw_container_clear(HWND handle, int redraw)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9145 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9146 PCNRITEM pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9147 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
9148
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9149 if(hwndEmph == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9150 _clear_emphasis();
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 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
9153
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9154 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9155 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9156 if(container)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9157 _dw_container_free_strings(handle, (PRECORDCORE)pCore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9158 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9159 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9160 /* Free icon text */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9161 if(pCore->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9162 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9163 free(pCore->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9164 pCore->rc.pszIcon = 0;
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 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
9168 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9169 _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
9170 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9171
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9172 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9173 * 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
9174 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9175 * 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
9176 * 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
9177 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9178 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
9179 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9180 RECORDCORE *last, **prc = malloc(sizeof(RECORDCORE *) * rowcount);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9181 int current = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9182
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9183 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
9184
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9185 while(last && current < rowcount)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9186 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9187 _dw_container_free_strings(handle, last);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9188 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
9189 current++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9190 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9191
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9192 _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
9193
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9194 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
9195 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9196
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9197 /*
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9198 * 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
9199 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9200 * 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
9201 * 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
9202 * 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
9203 * 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
9204 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9205 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
9206 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9207 rows = rows; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9208 switch(direction)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9209 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9210 case DW_SCROLL_TOP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9211 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
9212 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9213 case DW_SCROLL_BOTTOM:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9214 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(10000000));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9215 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9216 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9217 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9218
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9219 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9220 * Starts a new query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9221 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9222 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9223 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9224 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9225 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9226 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9227 char * API dw_container_query_start(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9228 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9229 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
9230
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9231 if(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9232 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9233 if(flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9234 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9235 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9236 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9237 if(pCore->flRecordAttr & flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9238 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9239 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
9240 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9241 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9242 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
9243 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9244 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9245 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9246 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9247 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
9248 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9249 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9250 }
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
9251 return NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9252 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9253
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9254 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9255 * Continues an existing query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9256 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9257 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9258 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9259 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9260 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9261 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9262 char * API dw_container_query_next(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9263 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9264 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
9265
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9266 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
9267
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9268 if(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9269 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9270 if(flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9271 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9272 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9273 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9274 if(pCore->flRecordAttr & flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9275 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9276 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
9277 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9278 }
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 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
9281 }
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9284 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9285 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
9286 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9287 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9288 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9289 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9290 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9291
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9292 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9293 * 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
9294 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9295 * 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
9296 * 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
9297 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9298 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
9299 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9300 RECTL viewport, item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9301 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
9302 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
9303
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9304 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9305 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9306 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
9307 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9308 QUERYRECORDRECT qrr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9309 int scrollpixels = 0, midway;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9310
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9311 qrr.cb = sizeof(QUERYRECORDRECT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9312 qrr.pRecord = pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9313 qrr.fRightSplitWindow = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9314 qrr.fsExtent = CMA_TEXT;
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 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
9317 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
9318 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9319
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9320 midway = (viewport.yTop - viewport.yBottom)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9321 scrollpixels = viewport.yTop - (item.yTop + midway);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9322
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9323 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(scrollpixels));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9324 return;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9327 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
9328 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9329 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9330
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9331 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9332 * 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
9333 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9334 * 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
9335 * 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
9336 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9337 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
9338 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9339 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
9340 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
9341
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9342 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9343 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9344 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
9345 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9346 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
9347 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9348 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9349 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
9350 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9351 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9352
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9353 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9354 * 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
9355 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9356 * 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
9357 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9358 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
9359 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9360 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9361 RECTL item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9362 PRECORDCORE pCore = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9363 int max = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9364
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9365 if(blah && !blah->flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9366 return;
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 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
9369 while(pCore)
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 QUERYRECORDRECT qrr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9372 int vector;
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 qrr.cb = sizeof(QUERYRECORDRECT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9375 qrr.pRecord = pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9376 qrr.fRightSplitWindow = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9377 qrr.fsExtent = CMA_TEXT;
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 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr);
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 vector = item.xRight - item.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9382
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9383 if(vector > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9384 max = vector;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9385
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9386 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
9387 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9388
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9389 if(max)
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 CNRINFO cnri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9392
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9393 cnri.cb = sizeof(CNRINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9394 cnri.xVertSplitbar = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9395
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9396 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_XVERTSPLITBAR));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9397 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9398 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9399
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9400 /*
487
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9401 * 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
9402 * Parameters:
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9403 * 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
9404 * 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
9405 * 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
9406 */
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
9407 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
9408 {
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9409 /* 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
9410 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
9411 return;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9412
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9413 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
9414 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
9415 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
9416 }
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9417
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9418 /*
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9419 * 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
9420 * Parameters:
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9421 * 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
9422 * 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
9423 */
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
9424 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
9425 {
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9426 /* 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
9427 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
9428 return;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9429
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9430 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
9431 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
9432 }
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9433
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9434 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9435 * Creates a rendering context widget (window) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9436 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9437 * id: An id to be used with dw_window_from_id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9438 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9439 * A handle to the widget or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9440 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9441 HWND API dw_render_new(unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9442 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9443 HWND hwndframe = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9444 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9445 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9446 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9447 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9448 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9449 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9450 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9451 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9452 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9453 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9454 WinSubclassWindow(hwndframe, _RendProc);
1645
69386c5a8e3e Fixed render widgets being incorrectly identified as boxes on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1642
diff changeset
9455 dw_window_set_data(hwndframe, "_dw_render", DW_INT_TO_POINTER(1));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9456 return hwndframe;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9457 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9458
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9459 /* Sets the current foreground drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9460 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9461 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9462 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9463 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9464 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9465 void API dw_color_foreground_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9466 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9467 _foreground = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9468 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9469
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9470 /* Sets the current background drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9471 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9472 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9473 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9474 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9475 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9476 void API dw_color_background_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9477 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9478 _background = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9479 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9480
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
9481 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
9482 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9483 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9484 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
9485 void *val;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9486
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9487 window = (HWND)dwwait->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9488 val = dw_window_get_data(window, "_dw_val");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9489
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9490 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9491 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9492 dw_window_destroy(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9493 dw_dialog_dismiss((DWDialog *)data, val);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9494 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
9495 }
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
9496
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
9497 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
9498 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9499 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9500 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
9501 unsigned long val;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9502
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9503 window = (HWND)dwwait->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9504 val = _dw_color_spin_get(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9505
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9506 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9507 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9508 dw_window_destroy(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9509 dw_dialog_dismiss((DWDialog *)data, (void *)val);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9510 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
9511 }
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
9512
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9513 /* 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
9514 * Parameters:
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9515 * value: current color
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9516 * Returns:
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9517 * The selected color or the current color if cancelled.
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9518 */
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9519 unsigned long API dw_color_choose(unsigned long value)
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9520 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9521 HWND window, hbox, vbox, col, button, text;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9522 DWDialog *dwwait;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9523 HMTX mtx = dw_mutex_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9524
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
9525 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
9526
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9527 vbox = dw_box_new(DW_VERT, 5);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9528
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9529 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
9530
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9531 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9532
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9533 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
9534 dw_window_set_style(hbox, 0, WS_CLIPCHILDREN);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9535
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9536 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
9537 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
9538
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9539 dw_window_set_data(hbox, "_dw_window", (void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9540 dw_window_set_data(window, "_dw_mutex", (void *)mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9541 dw_window_set_data(window, "_dw_col", (void *)col);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9542 dw_window_set_data(window, "_dw_val", (void *)value);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9543
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9544 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9545 dw_window_set_data(hbox, "_dw_window", (void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9546
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9547 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
9548
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9549 text = dw_text_new("Red:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9550 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
9551 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
9552
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9553 button = dw_spinbutton_new("", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9554 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9555 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
9556 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9557 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
9558
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9559 text = dw_text_new("Green:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9560 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
9561 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
9562
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9563 button = dw_spinbutton_new("", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9564 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9565 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
9566 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9567 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
9568
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9569 text = dw_text_new("Blue:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9570 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
9571 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
9572
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9573 button = dw_spinbutton_new("", 1003L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9574 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9575 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
9576 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9577 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
9578
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9579 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9580
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9581 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
9582 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
9583
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9584 button = dw_button_new("Ok", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9585 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
9586
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9587 dwwait = dw_dialog_new((void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9588
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9589 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
9590
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9591 button = dw_button_new("Cancel", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9592 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
9593
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9594 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
9595 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
9596
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9597 dw_window_set_size(window, 400, 400);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9598
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9599 _dw_col_set(col, value);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9600 _dw_color_spin_set(window, value);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9601
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9602 dw_window_show(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9603
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9604 return (unsigned long)dw_dialog_wait(dwwait);
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9605 }
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9606
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9607 HPS _set_hps(HPS hps)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9608 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9609 LONG alTable[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9610
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9611 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
9612 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
9613
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9614 GpiCreateLogColorTable(hps,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9615 LCOL_RESET,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9616 LCOLF_CONSECRGB,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9617 16,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9618 2,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9619 alTable);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9620 if(_foreground & DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9621 GpiSetColor(hps, 16);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9622 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9623 GpiSetColor(hps, _internal_color(_foreground));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9624 if(_background & DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9625 GpiSetBackColor(hps, 17);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9626 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9627 GpiSetBackColor(hps, _internal_color(_background));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9628 return hps;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9629 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9630
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9631 HPS _set_colors(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9632 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9633 HPS hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9634
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9635 _set_hps(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9636 return hps;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9637 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9638
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9639 /* Draw a point on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9640 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9641 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9642 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9643 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9644 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9645 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9646 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9647 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9648 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9649 int height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9650 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9651
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9652 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9653 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9654 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9655 height = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9656 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9657 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9658 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9659 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9660 height = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9661 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9662 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9663 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9664
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9665 ptl.x = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9666 ptl.y = height - y - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9667
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9668 GpiSetPel(hps, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9669 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9670 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9671 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9672
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9673 /* Draw a line on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9674 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9675 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9676 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9677 * x1: First X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9678 * y1: First Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9679 * x2: Second X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9680 * y2: Second Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9681 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9682 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
9683 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9684 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9685 int height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9686 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9687
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9688 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9689 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9690 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9691 height = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9692 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9693 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9694 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9695 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9696 height = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9697 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9698 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9699 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9700
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9701 ptl[0].x = x1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9702 ptl[0].y = height - y1 - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9703 ptl[1].x = x2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9704 ptl[1].y = height - y2 - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9705
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9706 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9707 GpiLine(hps, &ptl[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9708
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9709 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9710 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9711 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9712
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9713
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
9714 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
9715 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9716 FONTMETRICS fm;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9717 FATTRS fat;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9718 SIZEF sizf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9719
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9720 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
9721
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9722 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
9723
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9724 fat.usRecordLength = sizeof(FATTRS);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9725 fat.lMatch = fm.lMatch;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9726 strcpy(fat.szFacename, fm.szFacename);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9727
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9728 GpiCreateLogFont(hpsDst, 0, 1L, &fat);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9729 GpiSetCharSet(hpsDst, 1L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9730
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9731 sizf.cx = MAKEFIXED(fm.lEmInc,0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9732 sizf.cy = MAKEFIXED(fm.lMaxBaselineExt,0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9733 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
9734 }
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
9735
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9736 /* Draw text on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9737 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9738 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9739 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9740 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9741 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9742 * text: Text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9743 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9744 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
9745 {
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
9746 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
9747 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
9748 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
9749 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
9750 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
9751
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9752 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
9753 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9754 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
9755 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
9756 _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
9757 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9758 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
9759 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9760 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
9761
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9762 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
9763 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
9764 _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
9765 _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
9766 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
9767 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9768 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
9769 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
9770
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9771 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
9772 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9773 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
9774 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
9775 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9776
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9777 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
9778
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9779 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
9780 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
9781 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
9782 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
9783
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9784 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
9785 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
9786 else
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9787 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
9788
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9789 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
9790 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9791 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9792
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
9793 /* 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
9794 * 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
9795 * 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
9796 * 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
9797 * 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
9798 * 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
9799 * 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
9800 */
514
08d770271709 More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 513
diff changeset
9801 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
9802 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9803 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9804 POINTL aptl[TXTBOX_COUNT];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9805
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9806 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9807 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9808 hps = _set_colors(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9809 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9810 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9811 {
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
9812 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
9813
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9814 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9815 _CopyFontSettings(pixmaphps, hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9816 WinReleasePS(pixmaphps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9817 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9818 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9819 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9820
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9821 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
9822
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9823 if(width)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9824 *width = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9825
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9826 if(height)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9827 *height = aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9828
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9829 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9830 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
9831 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9832
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9833 /* 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
9834 * Parameters:
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9835 * handle: Handle to the window.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9836 * 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
9837 * 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
9838 * x: X coordinate.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9839 * y: Y coordinate.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9840 * width: Width of rectangle.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9841 * height: Height of rectangle.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9842 */
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
9843 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
9844 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9845 HPS hps;
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9846 int thisheight;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9847 POINTL *pptl;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9848 POINTL start;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9849 int i;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9850
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9851 if(handle)
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9852 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9853 hps = _set_colors(handle);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9854 thisheight = _get_height(handle);
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9855 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9856 else if(pixmap)
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9857 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9858 hps = _set_hps(pixmap->hps);
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9859 thisheight = pixmap->height;
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9860 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9861 else
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9862 return;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9863 if ( npoints == 0 )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9864 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9865 pptl = (POINTL *)malloc(sizeof(POINTL)*npoints);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9866 if ( pptl == NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9867 return;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9868 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9869 * 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
9870 */
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
9871 if ( flags & DW_DRAW_FILL )
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9872 GpiBeginArea( hps, 0L );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9873 if ( npoints )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9874 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9875 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9876 * 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
9877 */
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9878 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
9879 start.y = thisheight - y[0] - 1;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9880 GpiMove( hps, &start );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9881 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9882 * 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
9883 */
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9884 for ( i = 1; i < npoints; i++ )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9885 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9886 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
9887 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
9888 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9889 GpiPolyLine( hps, npoints-1, pptl );
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9890
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
9891 if ( flags & DW_DRAW_FILL )
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9892 GpiEndArea( hps );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9893 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9894 if ( !pixmap )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9895 WinReleasePS(hps);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9896 free( pptl );
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9897 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9898
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9899 /* Draw a rectangle on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9900 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9901 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9902 * 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
9903 * flags: DW_DRAW_FILL (1) to fill the box or DW_DRAW_DEFAULT (0).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9904 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9905 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9906 * width: Width of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9907 * height: Height of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9908 */
1276
1cdc18d760e0 Fixed improper fill method in dw_draw_rect() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1275
diff changeset
9909 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
9910 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9911 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9912 int thisheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9913 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9914
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9915 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9916 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9917 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9918 thisheight = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9919 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9920 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9921 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9922 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9923 thisheight = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9924 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9925 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9926 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9927
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9928 ptl[0].x = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9929 ptl[0].y = thisheight - y - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9930 ptl[1].x = x + width - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9931 ptl[1].y = thisheight - y - height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9932
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9933 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
9934 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
9935
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9936 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9937 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9938 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9939
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
9940 /* 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
9941 #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
9942 #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
9943 #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
9944
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9945 /* 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
9946 * Parameters:
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9947 * 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
9948 * 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
9949 * 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
9950 * 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
9951 * 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
9952 * 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
9953 * 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
9954 * 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
9955 * 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
9956 * 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
9957 */
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9958 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
9959 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9960 HPS hps;
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9961 int thisheight;
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9962 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
9963 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
9964 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
9965
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9966 if(handle)
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9967 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9968 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
9969 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
9970 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9971 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
9972 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9973 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
9974 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
9975 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9976 else
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9977 return;
1274
885b55c0d7d7 Implemented DW_DRAW_FULL and DW_DRAW_FILL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1262
diff changeset
9978
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
9979 /* 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
9980 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
9981 {
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
9982 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
9983 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
9984 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
9985 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
9986 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
9987 /* 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
9988 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
9989 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
9990 }
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
9991 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
9992 {
1290
d2c4deea6bf6 Simplified fill for ellipses and circles on OS/2 using DRO_OUTLINEFILL.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1286
diff changeset
9993 /* 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
9994 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
9995 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
9996
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
9997 /* 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
9998 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
9999 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
10000 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
10001 /* 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
10002 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
10003 /* 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
10004 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
10005 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
10006 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
10007 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
10008 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
10009 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
10010 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
10011 /* 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
10012 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
10013 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
10014 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
10015 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
10016 /* 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
10017 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
10018 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
10019 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
10020 }
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10021
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10022 if(!pixmap)
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10023 WinReleasePS(hps);
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10024 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10025
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10026 /* Call this after drawing to the screen to make sure
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10027 * anything you have drawn is visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10028 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10029 void API dw_flush(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10030 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10031 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10032
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10033 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10034 * Creates a pixmap with given parameters.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10035 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10036 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10037 * width: Width of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10038 * height: Height of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10039 * depth: Color depth of the pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10040 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10041 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10042 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10043 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
10044 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10045 BITMAPINFOHEADER bmih;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10046 SIZEL sizl = { 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10047 HPIXMAP pixmap;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10048 HDC hdc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10049 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10050 ULONG ulFlags;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10051 LONG cPlanes, cBitCount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10052
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10053 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10054 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10055
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10056 hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10057
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10058 hdc = GpiQueryDevice(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10059 ulFlags = GpiQueryPS(hps, &sizl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10060
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10061 pixmap->handle = handle;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10062 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
10063 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
10064
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10065 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10066 if (!depth)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10067 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10068 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10069 depth = cBitCount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10070 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10071
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10072 memset(&bmih, 0, sizeof(BITMAPINFOHEADER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10073 bmih.cbFix = sizeof(BITMAPINFOHEADER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10074 bmih.cx = (SHORT)width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10075 bmih.cy = (SHORT)height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10076 bmih.cPlanes = (SHORT)cPlanes;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10077 bmih.cBitCount = (SHORT)depth;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10078
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10079 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
10080 pixmap->transcolor = DW_CLR_DEFAULT;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10081
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10082 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
10083
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10084 GpiSetBitmap(pixmap->hps, pixmap->hbm);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10085
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10086 if (depth>8)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10087 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
10088
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10089 WinReleasePS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10090
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10091 return pixmap;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10092 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10093
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10094 /*
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10095 * Creates a pixmap from a file.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10096 * Parameters:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10097 * 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
10098 * 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
10099 * DW pick the appropriate file extension.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10100 * (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
10101 * Returns:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10102 * 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
10103 */
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10104 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
10105 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10106 HPIXMAP pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10107 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10108
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10109 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
10110 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10111
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10112 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10113
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10114 /* 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
10115 if ( access(file, 04) != 0 )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10116 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10117 /* Try with .bmp extention */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10118 strcat(file, ".bmp");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10119 if ( access(file, 04) != 0 )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10120 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10121 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10122 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10123 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10124 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10125
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10126 /* 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
10127 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
10128 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10129 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10130 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10131 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10132
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10133 /* Success fill in other values */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10134 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
10135 pixmap->transcolor = DW_CLR_DEFAULT;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10136
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10137 return pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10138 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10139
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10140 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10141 * Creates a pixmap from memory.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10142 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10143 * 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
10144 * data: Source of the image data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10145 * (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
10146 * le: length of data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10147 * Returns:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10148 * 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
10149 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10150 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
10151 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10152 HPIXMAP pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10153 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10154 FILE *fp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10155
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10156 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
10157 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10158
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10159 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10160 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10161 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10162 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10163 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10164 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10165 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10166 fclose( fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10167 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
10168 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10169 /* 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
10170 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
10171 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10172 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10173 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10174 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10175 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10176 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
10177 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10178 /* con't use ICO ? */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10179 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10180 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10181 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10182 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10183 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10184 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10185 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10186 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10187 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10188 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10189 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10190
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10191 /* Success fill in other values */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10192 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
10193 pixmap->transcolor = DW_CLR_DEFAULT;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10194
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10195 return pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10196 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10197
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10198 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10199 * 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
10200 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10201 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
10202 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10203 if ( pixmap )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10204 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10205 pixmap->transcolor = _internal_color(color);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10206 }
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10207 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10208
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10209 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10210 * Creates a pixmap from internal resource graphic specified by id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10211 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10212 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10213 * id: Resource ID associated with requested pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10214 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10215 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10216 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10217 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10218 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10219 BITMAPINFOHEADER bmih;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10220 SIZEL sizl = { 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10221 HPIXMAP pixmap;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10222 HDC hdc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10223 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10224 ULONG ulFlags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10225
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10226 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10227 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10228
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10229 hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10230
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10231 hdc = GpiQueryDevice(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10232 ulFlags = GpiQueryPS(hps, &sizl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10233
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10234 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
10235 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
10236
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10237 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10238
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10239 GpiQueryBitmapParameters(pixmap->hbm, &bmih);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10240
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10241 GpiSetBitmap(pixmap->hps, pixmap->hbm);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10242
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10243 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
10244 pixmap->transcolor = DW_CLR_DEFAULT;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10245
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10246 WinReleasePS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10247
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10248 return pixmap;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10249 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10250
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10251 /*
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10252 * 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
10253 * 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
10254 * 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
10255 * Parameters:
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10256 * 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
10257 * 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
10258 * 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
10259 * Returns:
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10260 * 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
10261 */
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10262 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
10263 {
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10264 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
10265 {
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
10266 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
10267 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
10268 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
10269 return DW_ERROR_NONE;
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10270 }
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10271 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
10272 }
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10273
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10274 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10275 * Destroys an allocated pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10276 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10277 * pixmap: Handle to a pixmap returned by
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10278 * dw_pixmap_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_pixmap_destroy(HPIXMAP pixmap)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10281 {
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
10282 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
10283 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
10284 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
10285 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
10286 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
10287 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
10288 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
10289 free(pixmap);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10290 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10291
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10292 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10293 * Copies from one item to another.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10294 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10295 * dest: Destination window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10296 * destp: Destination pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10297 * xdest: X coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10298 * ydest: Y coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10299 * width: Width of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10300 * height: Height of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10301 * src: Source window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10302 * srcp: Source pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10303 * xsrc: X coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10304 * ysrc: Y coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10305 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10306 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
10307 {
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10308 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
10309 }
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10310
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10311 /*
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10312 * 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
10313 * Parameters:
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10314 * 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
10315 * 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
10316 * 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
10317 * 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
10318 * 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
10319 * 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
10320 * 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
10321 * 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
10322 * 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
10323 * 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
10324 * 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
10325 * 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
10326 * Returns:
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10327 * 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
10328 */
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10329 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
10330 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10331 HPS hpsdest;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10332 HPS hpssrc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10333 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
10334 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
10335 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
10336
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
10337 /* 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
10338 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
10339 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
10340
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10341 if(dest)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10342 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10343 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
10344 dheight = _get_height(dest);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10345 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10346 else if(destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10347 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10348 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
10349 dheight = destp->height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10350 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10351 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
10352 return DW_ERROR_GENERAL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10353
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10354 if(src)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10355 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10356 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
10357 sheight = _get_height(src);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10358 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10359 else if(srcp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10360 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10361 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
10362 sheight = srcp->height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10363 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10364 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10365 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10366 if(!destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10367 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
10368 return DW_ERROR_GENERAL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10369 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10370
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10371 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
10372 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
10373 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
10374 ptl[1].y = dheight - ydest;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10375 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
10376 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
10377 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
10378 {
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10379 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
10380 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
10381 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
10382 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10383
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
10384 /* 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
10385 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
10386 {
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
10387 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
10388 /* 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
10389 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
10390 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
10391 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
10392 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
10393 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
10394 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
10395 }
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
10396 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
10397 {
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
10398 /* 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
10399 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
10400 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10401
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10402 if(!destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10403 WinReleasePS(hpsdest);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10404 if(!srcp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10405 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
10406 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10407 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10408
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
10409 /* 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
10410 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
10411 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10412 int *info = (int *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10413
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10414 if(data)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10415 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10416 DosBeep(info[0], info[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10417 free(data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10418 }
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
10419 }
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
10420
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10421 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10422 * Emits a beep.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10423 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10424 * freq: Frequency.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10425 * dur: Duration.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10426 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10427 void API dw_beep(int freq, int dur)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10428 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10429 int *info = malloc(sizeof(int) * 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10430
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10431 if(info)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10432 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10433 info[0] = freq;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10434 info[1] = dur;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10435
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10436 _beginthread(_beepthread, NULL, 100, (void *)info);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10437 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10438 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10439
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10440 /* Open a shared library and return a handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10441 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10442 * name: Base name of the shared library.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10443 * handle: Pointer to a module handle,
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10444 * will be filled in with the handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10445 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10446 int API dw_module_load(char *name, HMOD *handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10447 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10448 char objnamebuf[300] = "";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10449
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10450 return DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)name, handle);
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10451 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10452
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10453 /* Queries the address of a symbol within open handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10454 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10455 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10456 * name: Name of the symbol you want the address of.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10457 * func: A pointer to a function pointer, to obtain
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10458 * the address.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10459 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10460 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
10461 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10462 return DosQueryProcAddr(handle, 0, (PSZ)name, (PFN*)func);
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10463 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10464
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10465 /* Frees the shared library previously opened.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10466 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10467 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10468 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10469 int API dw_module_close(HMOD handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10470 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10471 DosFreeModule(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10472 return 0;
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10473 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10474
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10475 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10476 * Returns the handle to an unnamed mutex semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10477 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10478 HMTX API dw_mutex_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10479 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10480 HMTX mutex;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10481
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10482 DosCreateMutexSem(NULL, &mutex, 0, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10483 return mutex;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10484 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10485
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10486 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10487 * Closes a semaphore created by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10488 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10489 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10490 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10491 void API dw_mutex_close(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10492 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10493 DosCloseMutexSem(mutex);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10494 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10495
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10496 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10497 * 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
10498 * 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
10499 * while blocking.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10500 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10501 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10502 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10503 void API dw_mutex_lock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10504 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10505 if(_dwtid == dw_thread_id())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10506 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10507 int rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10508
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10509 while(rc == ERROR_TIMEOUT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10510 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10511 dw_main_sleep(10);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10512 rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN);
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 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
10515 else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10516 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10517 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10518
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10519 /*
1158
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10520 * 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
10521 * Parameters:
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10522 * 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
10523 * Returns:
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10524 * 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
10525 */
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10526 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
10527 {
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10528 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
10529 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
10530 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
10531 }
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10532
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10533 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10534 * Reliquishes the access to the semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10535 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10536 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10537 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10538 void API dw_mutex_unlock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10539 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10540 DosReleaseMutexSem(mutex);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10541 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10542
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10543 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10544 * Returns the handle to an unnamed event semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10545 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10546 HEV API dw_event_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10547 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10548 HEV blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10549
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10550 if(DosCreateEventSem (NULL, &blah, 0L, FALSE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10551 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10552
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10553 return blah;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10554 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10555
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10556 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10557 * Resets a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10558 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10559 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10560 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10561 int API dw_event_reset(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10562 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10563 ULONG count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10564
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10565 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
10566 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
10567 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10568 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10569
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10570 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10571 * Posts a semaphore created by dw_event_new(). Causing all threads
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10572 * waiting on this event in dw_event_wait to continue.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10573 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10574 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10575 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10576 int API dw_event_post(HEV eve)
3
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 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
10579 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
10580 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10581 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10582
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10583
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10584 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10585 * Waits on a semaphore created by dw_event_new(), until the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10586 * event gets posted or until the timeout expires.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10587 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10588 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10589 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10590 int API dw_event_wait(HEV eve, unsigned long timeout)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10591 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10592 int rc = DosWaitEventSem(eve, timeout);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10593 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
10594 return DW_ERROR_NONE;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10595 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
10596 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
10597 return DW_ERROR_GENERAL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10598 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10599
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10600 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10601 * Closes a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10602 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10603 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10604 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10605 int API dw_event_close(HEV *eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10606 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10607 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
10608 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
10609 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10610 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10611
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
10612 /* 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
10613 * 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
10614 * 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
10615 * 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
10616 * 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
10617 * 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
10618 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10619 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
10620 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10621 char *semname = malloc(strlen(name)+8);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10622 HEV ev = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10623
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10624 if(!semname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10625 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10626
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10627 strcpy(semname, "\\sem32\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10628 strcat(semname, name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10629
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10630 DosCreateEventSem((PSZ)semname, &ev, 0L, FALSE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10631
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10632 free(semname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10633 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
10634 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10635
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10636 /* 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
10637 * 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
10638 * 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
10639 * 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
10640 * 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
10641 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10642 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
10643 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10644 char *semname = malloc(strlen(name)+8);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10645 HEV ev;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10646
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10647 if(!semname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10648 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10649
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10650 strcpy(semname, "\\sem32\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10651 strcat(semname, name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10652
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10653 DosOpenEventSem((PSZ)semname, &ev);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10654
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10655 free(semname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10656 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
10657 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10658
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10659 /* 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
10660 * 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
10661 * 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
10662 * 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
10663 * 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
10664 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10665 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
10666 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10667 ULONG count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10668
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10669 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
10670 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10671
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10672 /* 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
10673 * 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
10674 * 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
10675 * 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
10676 * 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
10677 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10678 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
10679 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10680 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
10681 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10682
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10683
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10684 /* 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
10685 * 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
10686 * 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
10687 * 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
10688 * 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
10689 * 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
10690 * 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
10691 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10692 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
10693 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10694 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10695
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10696 rc = DosWaitEventSem(eve, timeout);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10697 switch (rc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10698 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10699 case ERROR_INVALID_HANDLE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10700 rc = DW_ERROR_NON_INIT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10701 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10702 case ERROR_NOT_ENOUGH_MEMORY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10703 rc = DW_ERROR_NO_MEM;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10704 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10705 case ERROR_INTERRUPT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10706 rc = DW_ERROR_INTERRUPT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10707 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10708 case ERROR_TIMEOUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10709 rc = DW_ERROR_TIMEOUT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10710 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10711 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10712
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10713 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
10714 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10715
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10716 /* 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
10717 * 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
10718 * 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
10719 * 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
10720 * 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
10721 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10722 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
10723 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10724 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10725
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10726 rc = DosCloseEventSem(eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10727 switch (rc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10728 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10729 case ERROR_INVALID_HANDLE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10730 rc = DW_ERROR_NON_INIT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10731 break;
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 case ERROR_SEM_BUSY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10734 rc = DW_ERROR_INTERRUPT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10735 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10738 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
10739 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10740
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10741 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10742 * 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
10743 * 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
10744 * 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
10745 * 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
10746 * 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
10747 * 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
10748 */
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
10749 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
10750 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10751 char namebuf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10752
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10753 sprintf(namebuf, "\\sharemem\\%s", name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10754
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10755 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
10756 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10757
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10758 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
10759 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10760
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10761 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10762 * 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
10763 * 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
10764 * 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
10765 * 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
10766 * 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
10767 */
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
10768 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
10769 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10770 char namebuf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10771
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10772 size = size;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10773 sprintf(namebuf, "\\sharemem\\%s", name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10774
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10775 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
10776 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10777
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10778 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
10779 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10780
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10781 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10782 * 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
10783 * 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
10784 * 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
10785 * 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
10786 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10787 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
10788 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10789 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10790
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10791 if(DosFreeMem(ptr) != NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10792 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10793 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
10794 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10795
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10796 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10797 * Encapsulate the message queues on OS/2.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10798 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10799 void _dwthreadstart(void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10800 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10801 HAB thishab = WinInitialize(0);
1642
e21c70d75cb1 For safety reasons on OS/2 in case the codepage isn't inherited...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1639
diff changeset
10802 HMQ thishmq = WinCreateMsgQueue(thishab, 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
10803 void (API_FUNC threadfunc)(void *) = NULL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10804 void **tmp = (void **)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10805
1642
e21c70d75cb1 For safety reasons on OS/2 in case the codepage isn't inherited...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1639
diff changeset
10806 /* Set the codepage to 1208 (UTF-8) */
e21c70d75cb1 For safety reasons on OS/2 in case the codepage isn't inherited...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1639
diff changeset
10807 WinSetCp(thishmq, 1208);
e21c70d75cb1 For safety reasons on OS/2 in case the codepage isn't inherited...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1639
diff changeset
10808
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
10809 threadfunc = (void (API_FUNC)(void *))tmp[0];
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10810 threadfunc(tmp[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10811
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10812 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10813
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10814 WinDestroyMsgQueue(thishmq);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10815 WinTerminate(thishab);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10816 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10817
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10818 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10819 * Creates a new thread with a starting point of func.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10820 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10821 * func: Function which will be run in the new thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10822 * data: Parameter(s) passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10823 * stack: Stack size of new thread (OS/2 and Windows only).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10824 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10825 DWTID API dw_thread_new(void *func, void *data, int stack)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10826 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10827 void **tmp = malloc(sizeof(void *) * 2);
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 tmp[0] = func;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10830 tmp[1] = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10831
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10832 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10833 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10834
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10835 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10836 * Ends execution of current thread immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10837 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10838 void API dw_thread_end(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10839 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10840 _endthread();
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10841 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10842
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10843 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10844 * Returns the current thread's ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10845 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10846 DWTID API dw_thread_id(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10847 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10848 return (DWTID)_threadid;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10849 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10850
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10851 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10852 * Cleanly terminates a DW session, should be signal handler safe.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10853 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10854 * exitcode: Exit code reported to the operating system.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10855 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10856 void API dw_exit(int exitcode)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10857 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10858 /* Destroy the menu message window */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10859 dw_window_destroy(hwndApp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10860
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10861 /* 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
10862 * try to free memory that could possibly be
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10863 * free()'d by the runtime already.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10864 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10865 Root = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10866
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10867 /* 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
10868 WinDestroyMsgQueue(dwhmq);
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10869 WinTerminate(dwhab);
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10870
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10871 /* Free any in use modules */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10872 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
10873 DosFreeModule(pmprintf);
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10874 DosFreeModule(pmmerge);
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10875
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
10876 /* And finally exit */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10877 exit(exitcode);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10878 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10879
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10880 /*
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
10881 * 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
10882 * 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
10883 * 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
10884 * 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
10885 * 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
10886 * 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
10887 * 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
10888 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10889 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
10890 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10891 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
10892 (PSZ)SplitbarClassName,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10893 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10894 WS_VISIBLE | WS_CLIPCHILDREN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10895 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10896 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10897 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10898 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10899 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10900 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10901 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10902 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10903 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
10904 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
10905
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10906 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
10907 WinSetParent(tmpbox, tmp, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10908 dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10909
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10910 tmpbox = dw_box_new(DW_VERT, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10911 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
10912 WinSetParent(tmpbox, tmp, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10913 *percent = 50.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10914 dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10915 dw_window_set_data(tmp, "_dw_percent", (void *)percent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10916 dw_window_set_data(tmp, "_dw_type", (void *)type);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10917 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10918 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
10919 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10920
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10921 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10922 * 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
10923 * 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
10924 * 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
10925 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10926 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
10927 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10928 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
10929 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
10930 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
10931
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10932 if(mypercent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10933 *mypercent = percent;
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 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
10936
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10937 _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
10938 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10939
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10940 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10941 * 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
10942 * 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
10943 * 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
10944 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10945 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
10946 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10947 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
10948
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10949 if(percent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10950 return *percent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10951 return 0.0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10952 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10953
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10954 /* The following two functions graciously contributed by Peter Nielsen. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10955 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10956 char* pchStart = pchBuffer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10957 char* pchEnd = pchStart + ulSize - 2;
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 while (pchEnd >= pchStart)
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 if ((pchEnd[0] == '#') && (pchEnd[1] == '@'))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10962 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10963 *pchEnd-- = '\0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10964 while (pchEnd >= pchStart)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10965 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10966 if ((pchEnd[0] == '@') && (pchEnd[1] == '#'))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10967 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10968 ULONG ulMajor = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10969 ULONG ulMinor = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10970
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10971 char* pch = pchEnd + 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10972 while (!isdigit ((int)*pch) && *pch)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10973 pch++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10974
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10975 while (isdigit ((int)*pch))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10976 ulMajor = ulMajor * 10 + *pch++ - '0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10977
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10978 if (*pch == '.')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10979 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10980 while (isdigit ((int)*++pch))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10981 ulMinor = ulMinor * 10 + *pch - '0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10982 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10983 return ((ulMajor << 16) | ulMinor);
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 pchEnd--;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10988 pchEnd--;
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 return (0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10991 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10992
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10993 ULONG _GetSystemBuildLevel(void) {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10994 /* 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
10995 * 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
10996 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10997 ULONG ulBootDrive = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10998 ULONG ulBuild = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10999 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
11000 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11001 char achFileName[11] = "C:\\OS2KRNL";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11002 HFILE hfile;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11003 ULONG ulResult;
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11004
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11005 achFileName[0] = (char)('A'+ulBootDrive-1);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11006
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11007 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
11008 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11009 ULONG ulFileSize = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11010 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11011 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11012 const ULONG ulFirstTry = min (256, ulFileSize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11013 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
11014 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11015 char *pchBuffer = malloc(ulFirstTry);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11016 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11017 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11018 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11019 if (ulBuild == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11020 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11021 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11022 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11023 free(pchBuffer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11024 pchBuffer = malloc(ulFileSize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11025
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11026 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11027 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11028 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11029 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11030 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11031 free(pchBuffer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11032 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11033 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11034 DosClose (hfile);
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11037 return (ulBuild);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11038 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11039
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
11040 /*
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
11041 * 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
11042 * 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
11043 * 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
11044 * 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
11045 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11046 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
11047 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11048 Box *thisbox = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11049 HWND box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11050
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11051 box = WinWindowFromID(window, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11052 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11053 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11054
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11055 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11056 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
11057 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11058
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11059 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
11060 * 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
11061 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
11062 * 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
11063 * 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
11064 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11065 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
11066 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11067 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11068
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11069 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11070 blah->clickdefault = next;
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
11071 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
11072
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
11073 /*
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11074 * 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
11075 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11076 * None.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11077 * Returns:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11078 * 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
11079 * be converted to text.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11080 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11081 char *dw_clipboard_get_text()
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11082 {
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
11083 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
11084 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
11085 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
11086
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11087 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
11088
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11089 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
11090 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
11091 {
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11092 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
11093 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
11094 }
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11095 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
11096 return retbuf;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11097 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11098
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11099 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11100 * 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
11101 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11102 * Text.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11103 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11104 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
11105 {
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
11106 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
11107 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
11108
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11109 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
11110 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
11111
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11112 /* 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
11113
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11114 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
11115 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
11116
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11117 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
11118 {
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11119 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
11120
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11121 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
11122 }
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11123
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11124 WinCloseClipbrd(dwhab); /* Close clipboard */
822
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
11125 return;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11126 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11127
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11128 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11129 * Returns some information about the current operating environment.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11130 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11131 * env: Pointer to a DWEnv struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11132 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11133 void API dw_environment_query(DWEnv *env)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11134 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11135 ULONG Build;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11136
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11137 if(!env)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11138 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11139
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11140 /* The default is OS/2 2.0 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11141 strcpy(env->osName,"OS/2");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11142 env->MajorVersion = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11143 env->MinorVersion = 0;
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 Build = _GetSystemBuildLevel();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11146 env->MinorBuild = Build & 0xFFFF;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11147 env->MajorBuild = Build >> 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11148
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11149 if (aulBuffer[0] == 20)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11150 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11151 int i = (unsigned int)aulBuffer[1];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11152 if (i > 20)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11153 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11154 strcpy(env->osName,"Warp");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11155 env->MajorVersion = (int)i/10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11156 env->MinorVersion = i-(((int)i/10)*10);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11157 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11158 else if (i == 10)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11159 env->MinorVersion = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11160 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11161 strcpy(env->buildDate, __DATE__);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11162 strcpy(env->buildTime, __TIME__);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11163 env->DWMajorVersion = DW_MAJOR_VERSION;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11164 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
11165 #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
11166 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
11167 #else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11168 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
11169 #endif
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11170 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11171
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11172 /* 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
11173 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
11174 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11175 FILEFINDBUF3 ffbuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11176 HTREEITEM item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11177 ULONG count = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11178 HDIR hdir = HDIR_CREATE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11179
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11180 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
11181 &ffbuf, sizeof(FILEFINDBUF3), &count, FIL_STANDARD) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11182 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11183 while(DosFindNext(hdir, &ffbuf, sizeof(FILEFINDBUF3), &count) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11184 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11185 if(strcmp(ffbuf.achName, ".") && strcmp(ffbuf.achName, ".."))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11186 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11187 int len = strlen(path);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11188 char *folder = malloc(len + ffbuf.cchName + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11189 HTREEITEM tempitem;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11190
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11191 strcpy(folder, path);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11192 strcpy(&folder[len-1], ffbuf.achName);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11193
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11194 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
11195 tempitem = dw_tree_insert(tree, "", 0, item, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11196 dw_tree_item_set_data(tree, item, (void *)tempitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11197 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11198 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11199 DosFindClose(hdir);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11200 }
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11201 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11202
906
71b0e132d9df Added missing API to _popuplate_tree_thread() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 904
diff changeset
11203 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
11204 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11205 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
11206 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
11207 int drive;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11208 HTREEITEM items[26];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11209 FSINFO volinfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11210
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11211 DosError(FERR_DISABLEHARDERR);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11212
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11213 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11214 for(drive=0;drive<26;drive++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11215 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11216 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
11217 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11218 char folder[5] = "C:\\", name[9] = "Drive C:";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11219 HTREEITEM tempitem;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11220
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11221 folder[0] = name[6] = 'A' + drive;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11222
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11223 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
11224 tempitem = dw_tree_insert(tree, "", 0, items[drive], 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11225 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
11226 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11227 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11228 items[drive] = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11229 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11230 dw_mutex_unlock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11231
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11232 DosError(FERR_ENABLEHARDERR);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11233 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11234
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11235 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
11236 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11237 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11238 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
11239 void *treedata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11240
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11241 window = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11242 if(!dwwait)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11243 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11244
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11245 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11246 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
11247 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11248 dw_window_destroy((HWND)dwwait->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11249 dw_dialog_dismiss((DWDialog *)data, treedata);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11250 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11251 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11252
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11253 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
11254 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11255 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11256 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
11257
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11258 window = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11259 if(!dwwait)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11260 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11261
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11262 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11263 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11264 dw_window_destroy((HWND)dwwait->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11265 dw_dialog_dismiss((DWDialog *)data, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11266 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11267 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11268
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
11269 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
11270 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11271 char *folder=strdup("");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11272 HTREEITEM parent = item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11273
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11274 while(parent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11275 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11276 char *temp, *text = dw_tree_get_title(tree, parent);
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(text)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11279 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11280 if(strncmp(text, "Drive ", 6) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11281 text = &text[6];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11282
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11283 temp = malloc(strlen(text) + strlen(folder) + 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11284 strcpy(temp, text);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11285 strcat(temp, "\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11286 strcat(temp, folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11287 free(folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11288 folder = temp;
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 parent = dw_tree_get_parent(tree, parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11291 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11292 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
11293 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
11294
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11295 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
11296 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11297 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11298 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
11299
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11300 text = text; itemdata = itemdata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11301 if(treedata)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11302 free(treedata);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11303
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11304 treedata = _tree_folder(window, item);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11305 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
11306
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11307 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11308 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11309
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
11310 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
11311 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11312 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
11313
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11314 data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11315 if(tempitem)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11316 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11317 char *folder = _tree_folder(window, item);
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 dw_tree_item_set_data(window, item, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11320 dw_tree_item_delete(window, tempitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11321
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11322 if(*folder)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11323 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11324 strcat(folder, "*");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11325 _populate_directory(window, item, folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11326 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11327 free(folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11328 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11329
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11330 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
11331 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
11332
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11333 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11334 * Opens a file dialog and queries user selection.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11335 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11336 * title: Title bar text for dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11337 * defpath: The default path of the open dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11338 * ext: Default file extention.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11339 * flags: DW_FILE_OPEN or DW_FILE_SAVE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11340 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11341 * NULL on error. A malloced buffer containing
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11342 * the file path on success.
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
11343 *
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11344 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11345 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11346 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11347 if(flags == DW_DIRECTORY_OPEN)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11348 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11349 HWND window, hbox, vbox, tree, button;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11350 DWDialog *dwwait;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11351 HMTX mtx = dw_mutex_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11352
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
11353 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
11354
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11355 vbox = dw_box_new(DW_VERT, 5);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11356
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11357 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
11358
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11359 tree = dw_tree_new(60);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11360
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11361 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
11362 dw_window_set_data(window, "_dw_mutex", (void *)mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11363 dw_window_set_data(window, "_dw_tree", (void *)tree);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11364
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11365 hbox = dw_box_new(DW_HORZ, 0);
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 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
11368
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11369 dwwait = dw_dialog_new((void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11370
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11371 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
11372 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
11373
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11374 button = dw_button_new("Ok", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11375 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
11376 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
11377
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11378 button = dw_button_new("Cancel", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11379 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
11380 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
11381 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
11382
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11383 dw_window_set_size(window, 225, 300);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11384 dw_window_show(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11385
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11386 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
11387 return (char *)dw_dialog_wait(dwwait);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11388 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11389 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11390 {
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11391 FILEDLG fild = { 0 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11392 HWND hwndFile;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11393 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
11394 struct stat buf;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11395
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11396 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
11397 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11398 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
11399 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
11400 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11401
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11402 len = strlen(fild.szFullFile);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11403
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11404 /* If we have a defpath */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11405 if(len)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11406 {
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11407 /* 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
11408 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
11409 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11410 /* 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
11411 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
11412 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11413 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
11414 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
11415 /* 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
11416 len = 0;
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11417 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11418 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11419 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11420
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11421 /* 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
11422 if(!len)
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11423 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11424 /* 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
11425 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
11426
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11427 /* 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
11428 if(ext)
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11429 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11430 /* 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
11431 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
11432 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
11433 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11434 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11435
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11436 /* Setup the structure */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11437 fild.cbSize = sizeof(FILEDLG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11438 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
11439 fild.pszTitle = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11440 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
11441 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11442
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11443 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11444 if(hwndFile)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11445 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11446 switch(fild.lReturn)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11447 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11448 case DID_OK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11449 return strdup(fild.szFullFile);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11450 case DID_CANCEL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11451 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11452 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11453 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11454 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11455 return NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11456 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11457
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11458 /* 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
11459 int _SetPath(char *path)
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11460 {
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11461 #ifndef __WATCOMC__
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11462 if(strlen(path) > 2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11463 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11464 if(path[1] == ':')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11465 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11466 char drive = toupper(path[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11467 _chdrive((drive - 'A')+1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11468 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11469 }
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11470 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11471 return chdir(path);
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11472 }
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11473
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11474 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11475 * Execute and external program in a seperate session.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11476 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11477 * program: Program name with optional path.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11478 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11479 * params: An array of pointers to string arguements.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11480 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11481 * -1 on error.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11482 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11483 int API dw_exec(char *program, int type, char **params)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11484 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11485 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
11486 return spawnvp(P_NOWAIT, program, (char * const *)params);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11487 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11488
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11489 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11490 * Loads a web browser pointed at the given URL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11491 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11492 * url: Uniform resource locator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11493 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11494 int API dw_browse(char *url)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11495 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11496 char *execargs[3], browser[1024], *olddir, *newurl = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11497 int len, ret;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11498
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11499 olddir = _getcwd(NULL, 1024);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11500
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11501 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
11502 (PSZ)"DefaultWorkingDir", NULL, (PSZ)browser, 1024);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11503
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11504 if(browser[0])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11505 _SetPath(browser);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11506
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11507 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
11508 (PSZ)"DefaultBrowserExe", NULL, (PSZ)browser, 1024);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11509
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11510 len = strlen(browser) - strlen("explore.exe");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11511
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11512 execargs[0] = browser;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11513 execargs[1] = url;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11514 execargs[2] = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11515
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11516 /* Special case for Web Explorer, it requires file:/// instead
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11517 * of file:// so I am handling it here.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11518 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11519 if(len > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11520 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11521 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
11522 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11523 int newlen, z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11524 newurl = malloc(strlen(url) + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11525 sprintf(newurl, "file:///%s", &url[7]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11526 newlen = strlen(newurl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11527 for(z=8;z<(newlen-8);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11528 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11529 if(newurl[z] == '|')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11530 newurl[z] = ':';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11531 if(newurl[z] == '/')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11532 newurl[z] = '\\';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11533 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11534 execargs[1] = newurl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11535 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11536 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11537
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11538 ret = dw_exec(browser, DW_EXEC_GUI, execargs);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11539
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11540 if(olddir)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11541 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11542 _SetPath(olddir);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11543 free(olddir);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11544 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11545 if(newurl)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11546 free(newurl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11547 return ret;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11548 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11549
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11550 /*
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11551 * 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
11552 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11553 * 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
11554 * 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
11555 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11556 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
11557 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11558 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11559 action = action;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11560 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11561
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11562 /*
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11563 * 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
11564 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11565 * 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
11566 * 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
11567 * be rendered.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11568 * Returns:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11569 * 0 on success.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11570 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11571 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
11572 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11573 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11574 string = string;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11575 return -1;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11576 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11577
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11578 /*
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11579 * 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
11580 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11581 * 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
11582 * 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
11583 * 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
11584 * Returns:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11585 * 0 on success.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11586 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11587 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
11588 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11589 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11590 url = url;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11591 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11592 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11593
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11594 /*
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11595 * Create a new HTML window (widget) to be packed.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11596 * 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
11597 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11598 * 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
11599 * 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
11600 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11601 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
11602 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11603 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
11604 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
11605 return 0;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11606 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11607
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11608 typedef struct _dwprint
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 HDC hdc;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11611 char *printername;
1183
0f85796c6988 Fix calling convention of print callback on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1182
diff changeset
11612 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
11613 void *drawdata;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11614 unsigned long flags;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11615 unsigned int startpage, endpage;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11616 char *jobname;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11617 } DWPrint;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11618
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11619 /* 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
11620 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
11621 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11622 DWPrint *print = (DWPrint *)data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11623 DWDialog *dwwait = (DWDialog *)print->printername;
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 window = (HWND)dwwait->data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11626
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11627 dw_window_destroy(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11628 dw_dialog_dismiss(dwwait, NULL);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11629 return FALSE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11630 }
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 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
11633 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11634 DWPrint *print = (DWPrint *)data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11635 DWDialog *dwwait = (DWDialog *)print->printername;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11636 HWND printerlist, startspin, endspin;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11637 char *result = NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11638
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11639 window = (HWND)dwwait->data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11640 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
11641 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
11642 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
11643 if(printerlist)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11644 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11645 char printername[32] = "";
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11646 int selected = dw_listbox_selected(printerlist);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11647
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11648 /* 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
11649 if(selected != DW_ERROR_UNKNOWN)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11650 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11651 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
11652 if(printername[0])
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11653 print->printername = result = strdup(printername);
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 /* Get the start and end positions */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11656 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
11657 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
11658
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11659 /* 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
11660 if(print->startpage > print->endpage)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11661 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11662 print->endpage = print->startpage;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11663 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
11664 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11665 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11666
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11667 dw_window_destroy(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11668 dw_dialog_dismiss(dwwait, (void *)result);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11669 return FALSE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11670 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11671
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11672 /* 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
11673 BOOL _ExtractLogAddress(char * LogAddress, char * DetailStr)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11674 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11675 char *p;
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 p = DetailStr;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11678 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
11679 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
11680 while(*p != ';') *LogAddress++ = *p++;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11681 *LogAddress = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11682 return TRUE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11683 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11684
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11685 BOOL _ExtractDriverName(char * DriverName, char * DetailStr)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11686 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11687 char *p;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11688
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11689 p = DetailStr;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11690 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
11691 while(*p != '.' && *p != ';' && *p != ',')
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11692 *DriverName++ = *p++;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11693 *DriverName = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11694 return TRUE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11695 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11696
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
11697 /* 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
11698 #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
11699 #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
11700 #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
11701
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
11702 /*
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11703 * 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
11704 * Parameters:
1152
58b5374355ab Added print jobname parameter to dw_print_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1150
diff changeset
11705 * 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
11706 * 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
11707 * 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
11708 * 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
11709 * 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
11710 * Returns:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11711 * 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
11712 */
1152
58b5374355ab Added print jobname parameter to dw_print_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1150
diff changeset
11713 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
11714 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11715 char printername[32], tmpbuf[20];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11716 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
11717 DWDialog *dwwait;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11718 DWPrint *print;
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11719 PVOID pBuf = NULL;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11720 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
11721 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
11722 SPLERR splerr = 0 ;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11723 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
11724 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
11725
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11726 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
11727 return NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11728
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11729 print->drawfunc = drawfunc;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11730 print->drawdata = drawdata;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11731 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
11732 print->startpage = 1;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11733 print->endpage = pages;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11734 print->flags = flags;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11735
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11736 /* 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
11737 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
11738
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11739 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
11740 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11741 /* 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
11742 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
11743
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11744 /* 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
11745 cbBuf = cbNeeded;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11746
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11747 /* 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
11748 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
11749 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11750
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11751 /* 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
11752 if(cb > 2)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11753 printername[cb-2] = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11754 else
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11755 printername[0] = '\0';
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11756
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11757 /* 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
11758 if(!cRes && !printername[0])
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11759 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11760 /* Show an error and return failure */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11761 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
11762 free(print);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11763 return NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11764 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11765
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11766 /* 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
11767 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
11768
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11769 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
11770
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11771 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
11772
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11773 printerlist = dw_listbox_new(0, FALSE);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11774 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
11775
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11776 /* 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
11777 if(pBuf && cRes)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11778 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11779 int count = 0;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11780
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11781 pRes = (PPRINTERINFO)pBuf ;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11782 while(cRes--)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11783 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11784 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
11785 /* 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
11786 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
11787 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
11788 count++;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11789 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11790 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11791 else
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11792 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11793 /* 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
11794 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
11795 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
11796 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11797
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11798 /* 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
11799 if(pBuf)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
11800 DosFreeMem(pBuf);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11801
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11802 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
11803
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11804 /* Start spinbutton */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11805 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
11806
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11807 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
11808
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11809 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
11810 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
11811 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
11812
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11813 button = dw_spinbutton_new("1", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11814 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
11815 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
11816 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
11817
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11818 /* End spinbutton */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11819 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
11820
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11821 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
11822
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11823 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
11824 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
11825 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
11826
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11827 sprintf(tmpbuf, "%d", pages);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11828 button = dw_spinbutton_new(tmpbuf, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11829 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
11830 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
11831 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
11832
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11833 /* Ok and Cancel buttons */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11834 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
11835
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11836 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
11837 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
11838
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11839 button = dw_button_new("Ok", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11840 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
11841
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11842 dwwait = dw_dialog_new((void *)window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11843 /* 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
11844 print->printername = (char *)dwwait;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11845
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11846 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
11847
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11848 button = dw_button_new("Cancel", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11849 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
11850
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11851 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
11852 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
11853
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11854 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
11855
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11856 dw_window_show(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11857
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11858 print->printername = dw_dialog_wait(dwwait);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11859
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11860 /* The user picked a printer */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11861 if(print->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11862 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11863 char PrintDetails[256];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11864 char DriverName[32];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11865 char LogAddress[32];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11866 DEVOPENSTRUC dop;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11867
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11868 /* 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
11869 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
11870 _ExtractLogAddress(LogAddress, PrintDetails);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11871 _ExtractDriverName(DriverName, PrintDetails);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11872 dop.pszDriverName = (PSZ)DriverName;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11873 dop.pszLogAddress = (PSZ)LogAddress;
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11874 dop.pdriv = NULL;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11875 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
11876 /* 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
11877 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
11878 if(print->hdc)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11879 return print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11880 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11881 /* The user canceled */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11882 if(print->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11883 free(print->printername);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11884 free(print);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11885 return NULL;
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11886 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11887
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11888 /*
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11889 * 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
11890 * Parameters:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11891 * 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
11892 * 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
11893 * Returns:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11894 * 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
11895 */
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11896 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
11897 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11898 DWPrint *p = print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11899 HPIXMAP pixmap;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11900 int x, result = DW_ERROR_UNKNOWN;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11901 SIZEL sizl = { 0, 0 };
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11902
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11903 if(!p)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11904 return result;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11905
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11906 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
11907 return result;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11908
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11909 /* Start the job */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11910 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
11911
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
11912 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
11913 pixmap->hdc = p->hdc;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11914 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
11915 pixmap->transcolor = DW_RGB_TRANSPARENT;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11916 pixmap->width = sizl.cx;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11917 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
11918 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
11919
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11920 /* Cycle through each page */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11921 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
11922 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11923 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
11924 /* Next page */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11925 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
11926 }
1183
0f85796c6988 Fix calling convention of print callback on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1182
diff changeset
11927 /* Determine the completion code */
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11928 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
11929 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11930 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
11931 /* 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
11932 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
11933 }
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
11934 else
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
11935 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
11936 /* Free memory */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11937 dw_pixmap_destroy(pixmap);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11938 if(p->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11939 free(p->printername);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11940 free(p);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11941 return result;
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11942 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11943
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11944 /*
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11945 * 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
11946 * Parameters:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11947 * 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
11948 */
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11949 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
11950 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11951 DWPrint *p = print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11952
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11953 if(p)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11954 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
11955 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11956
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11957 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11958 * Returns a pointer to a static buffer which containes the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11959 * current user directory. Or the root directory (C:\ on
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11960 * OS/2 and Windows).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11961 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11962 char * API dw_user_dir(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11963 {
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11964 static char _user_dir[MAX_PATH+1] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11965
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11966 if(!_user_dir[0])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11967 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11968 char *home = getenv("HOME");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11969
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11970 if(home)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11971 strcpy(_user_dir, home);
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 strcpy(_user_dir, "C:\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11974 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11975 return _user_dir;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11976 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11977
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11978 /*
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11979 * 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
11980 * 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
11981 */
1384
156e32814c83 Cleanup of the previous commits and added Unix support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1382
diff changeset
11982 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
11983 {
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11984 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
11985 }
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11986
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11987 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11988 * Call a function from the window (widget)'s context.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11989 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11990 * handle: Window handle of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11991 * function: Function pointer to be called.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11992 * data: Pointer to the data to be passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11993 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11994 void API dw_window_function(HWND handle, void *function, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11995 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11996 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11997 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11998
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11999 /* 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
12000 * 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
12001 * 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
12002 */
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
12003 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
12004 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12005 UserData *tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12006
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12007 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12008 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12009 if(stricmp(tmp->varname, varname) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12010 return tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12011 tmp = tmp->next;
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 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
12014 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12015
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
12016 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
12017 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12018 UserData *new = _find_userdata(root, varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12019
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12020 if(new)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12021 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12022 new->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12023 return TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12024 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12025 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12026 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12027 new = malloc(sizeof(UserData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12028 if(new)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12029 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12030 new->varname = strdup(varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12031 new->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12032
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12033 new->next = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12034
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12035 if (!*root)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12036 *root = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12037 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12038 {
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
12039 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
12040
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12041 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12042 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12043 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12044 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12045 }
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
12046 prev->next = new;
643
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 return TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12049 }
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 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
12052 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12053
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
12054 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
12055 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12056 UserData *prev = NULL, *tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12057
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12058 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12059 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12060 if(all || stricmp(tmp->varname, varname) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12061 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12062 if(!prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12063 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12064 *root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12065 free(tmp->varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12066 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12067 if(!all)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12068 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12069 tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12070 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12071 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12072 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12073 /* If all is true we should
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12074 * never get here.
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 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12077 free(tmp->varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12078 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12079 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12080 }
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12083 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12084 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12085 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12086 }
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 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
12089 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12090
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12091 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12092 * 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
12093 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12094 * 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
12095 * 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
12096 * 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
12097 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12098 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
12099 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12100 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12101
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12102 if(!blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12103 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12104 if(!dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12105 return;
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 blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12108 WinSetWindowPtr(window, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12109 }
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 if(data)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12112 _new_userdata(&(blah->root), dataname, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12113 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12114 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12115 if(dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12116 _remove_userdata(&(blah->root), dataname, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12117 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12118 _remove_userdata(&(blah->root), NULL, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12119 }
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12120 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12121
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12122 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12123 * 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
12124 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12125 * 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
12126 * 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
12127 * 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
12128 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
12129 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
12130 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12131 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12132
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12133 if(blah && blah->root && dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12134 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12135 UserData *ud = _find_userdata(&(blah->root), dataname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12136 if(ud)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12137 return ud->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12138 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12139 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
12140 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12141
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12142 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12143 * 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
12144 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12145 * 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
12146 * 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
12147 * 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
12148 * Returns:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12149 * 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
12150 */
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
12151 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
12152 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12153 if(sigfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12154 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12155 int timerid = WinStartTimer(dwhab, NULLHANDLE, 0, interval);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12156
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12157 if(timerid)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12158 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12159 _new_signal(WM_TIMER, NULLHANDLE, timerid, sigfunc, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12160 return timerid;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12161 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12162 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12163 return 0;
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12164 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12165
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12166 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12167 * Removes timer callback.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12168 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12169 * 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
12170 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12171 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
12172 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12173 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12174
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12175 /* 0 is an invalid timer ID */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12176 if(!id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12177 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12178
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12179 WinStopTimer(dwhab, NULLHANDLE, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12180
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12181 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12182 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12183 if(tmp->id == id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12184 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12185 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12186 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12187 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12188 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12189 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12190 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12191 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12192 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12193 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12194 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12195 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12196 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12197 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12198 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12199 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12200 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12201 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12202 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12203 }
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12204 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12205
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12206 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12207 * Add a callback to a window event.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12208 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12209 * window: Window handle of signal to be called back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12210 * signame: A string pointer identifying which signal to be hooked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12211 * sigfunc: The pointer to the function to be used as the callback.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12212 * data: User data to be passed to the handler function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12213 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12214 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12215 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12216 ULONG message = 0, id = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12217
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12218 if(window && signame && sigfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12219 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12220 if((message = _findsigmessage(signame)) != 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12221 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12222 /* Handle special case of the menu item */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12223 if(message == WM_COMMAND && window < 65536)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12224 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12225 char buffer[15];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12226 HWND owner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12227
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12228 sprintf(buffer, "_dw_id%d", (int)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12229 owner = (HWND)dw_window_get_data(hwndApp, buffer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12230
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
12231 /* 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
12232 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
12233
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12234 if(owner)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12235 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12236 id = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12237 window = owner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12238 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12239 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12240 _new_signal(message, window, id, sigfunc, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12241 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12242 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12243 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12244
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12245 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12246 * Removes callbacks for a given window with given name.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12247 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12248 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12249 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12250 void API dw_signal_disconnect_by_name(HWND window, char *signame)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12251 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12252 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12253 ULONG message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12254
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12255 if(!window || !signame || (message = _findsigmessage(signame)) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12256 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12257
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12258 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12259 {
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
12260 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
12261 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12262 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12263 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12264 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12265 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12266 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12267 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12268 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12269 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12270 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12271 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12272 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12273 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12274 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12275 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12276 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12277 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12278 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12279 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12280 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12281 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12282
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12283 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12284 * Removes all callbacks for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12285 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12286 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12287 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12288 void API dw_signal_disconnect_by_window(HWND window)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12289 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12290 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12291
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12292 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12293 {
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
12294 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
12295 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12296 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12297 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12298 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12299 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12300 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12301 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12302 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12303 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12304 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12305 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12306 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12307 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12308 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12309 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12310 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12311 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12312 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12313 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12314 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12315 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12316
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12317 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12318 * Removes all callbacks for a given window with specified data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12319 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12320 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12321 * data: Pointer to the data to be compared against.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12322 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12323 void API dw_signal_disconnect_by_data(HWND window, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12324 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12325 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12326
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12327 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12328 {
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
12329 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
12330 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12331 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12332 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12333 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12334 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12335 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12336 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12337 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12338 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12339 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12340 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12341 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12342 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12343 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12344 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12345 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12346 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12347 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12348 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12349 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12350 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12351
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
12352 /*
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
12353 * 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
12354 * Parameters:
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
12355 * 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
12356 * 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
12357 * 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
12358 */
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
12359 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
12360 {
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
12361 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
12362 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
12363 HWND tmp = WinCreateWindow(HWND_OBJECT,
1548
ef7959aae8da Clean up some warnings with GCC on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1547
diff changeset
12364 (PSZ)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
12365 NULL,
1534
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
12366 WS_VISIBLE,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12367 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12368 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12369 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12370 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12371 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12372 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
12373 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
12374 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
12375 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
12376 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
12377 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
12378 }
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
12379
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12380 /*
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
12381 * 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
12382 * 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
12383 * 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
12384 * 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
12385 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12386 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
12387 {
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12388 /* 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
12389 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
12390 year--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12391 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
12392 month--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12393 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
12394 day--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12395
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12396 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
12397 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
12398 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
12399 /* 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
12400 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
12401 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12402
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
12403 /*
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
12404 * 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
12405 * 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
12406 * 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
12407 * 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
12408 * 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
12409 * 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
12410 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12411 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
12412 {
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12413 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
12414 *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
12415 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
12416 *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
12417 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
12418 *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
12419 }