annotate os2/dw.c @ 1744:535e8c19a13d

Added dw_filesystem_set_column_title() function to aid in localization.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 04 Jun 2012 22:18:56 +0000
parents a297b2bde127
children 7dd1659c2693
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
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
40 #include <fcntl.h>
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
41 #include "dw.h"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
42
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
43 #define QWP_USER 0
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
44
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
45 /* 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
46 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
47
1382
3eedfd4f7c5d Bleah.. VAC doesn't have MAX_PATH... define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1381
diff changeset
48 #ifndef MAX_PATH
3eedfd4f7c5d Bleah.. VAC doesn't have MAX_PATH... define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1381
diff changeset
49 #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
50 #endif
3eedfd4f7c5d Bleah.. VAC doesn't have MAX_PATH... define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1381
diff changeset
51
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
52 #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
53 #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
54 #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
55 #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
56 #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
57
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
58 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
59 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
60 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
61 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
62 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y);
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
63 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height, int *depth);
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
64 void _free_menu_data(HWND menu);
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
65 BOOL (API_FUNC _WinQueryDesktopWorkArea)(HWND hwndDesktop, PWRECT pwrcWorkArea) = 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
66 /* PMPrintf support for dw_debug() */
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
67 ULONG (API_FUNC _PmPrintfString)(char *String) = 0;
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
68 /* GBM (Generalize Bitmap Module) support for file loading */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
69 #pragma pack(4)
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
70 typedef struct
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
71 {
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
72 int w, h, bpp;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
73 unsigned char priv[2000];
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
74 } GBM;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
75 typedef struct { unsigned char r, g, b; } GBMRGB;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
76 #pragma pack()
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
77 int (API_FUNC _gbm_init)(void) = 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
78 int (API_FUNC _gbm_deinit)(void) = 0;
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
79 int (API_FUNC _gbm_query_n_filetypes)(int *count) = 0;
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
80 int (API_FUNC _gbm_io_open)(const char *fn, int mode) = 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
81 int (API_FUNC _gbm_io_close)(int fd) = 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
82 int (API_FUNC _gbm_read_header)(const char *fn, int fd, int ft, GBM *gbm, const char *info) = 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
83 int (API_FUNC _gbm_read_palette)(int fd, int ft, GBM *gbm, GBMRGB *gbmrgb) = 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
84 int (API_FUNC _gbm_read_data)(int fd, int ft, GBM *gbm, unsigned char *data) = 0;
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
85 const char * (API_FUNC _gbm_err)(int rc) = 0;
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
86 /*
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
87 * GBM List of supported formats: BMP, PNG, JPEG, Targa, TIFF and XPM.
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
88 */
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
89 #define NUM_EXTS 8
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
90 char *image_exts[NUM_EXTS] =
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
91 {
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
92 ".bmp",
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
93 ".png",
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
94 ".jpg",
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
95 ".jpeg",
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
96 ".tga",
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
97 ".tif",
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
98 ".tiff",
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
99 ".xpm"
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
100 };
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
101
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
102
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
103 char ClassName[] = "dynamicwindows";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
104 char SplitbarClassName[] = "dwsplitbar";
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
105 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
106 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
107 char *DefaultFont = "9.WarpSans";
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
108
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
109 HAB dwhab = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
110 HMQ dwhmq = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
111 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
112 LONG _foreground = 0xAAAAAA, _background = DW_CLR_DEFAULT;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
113
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
114 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
115 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
116
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
117 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
118 ULONG aulBuffer[4];
190
f4c9fa77136a A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 185
diff changeset
119 HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop;
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
120 HMOD wpconfig = 0, pmprintf = 0, pmmerge = 0, gbm = 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
121 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
122
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
123 unsigned long _colors[] = {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
124 CLR_BLACK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
125 CLR_DARKRED,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
126 CLR_DARKGREEN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
127 CLR_BROWN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
128 CLR_DARKBLUE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
129 CLR_DARKPINK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
130 CLR_DARKCYAN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
131 CLR_PALEGRAY,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
132 CLR_DARKGRAY,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
133 CLR_RED,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
134 CLR_GREEN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
135 CLR_YELLOW,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
136 CLR_BLUE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
137 CLR_PINK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
138 CLR_CYAN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
139 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
140 };
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
141
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
142 #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
143
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
144 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
145
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
146 #ifndef min
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
147 #define min(a, b) (((a < b) ? a : b))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
148 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
149
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
150 typedef struct _sighandler
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
151 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
152 struct _sighandler *next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
153 ULONG message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
154 HWND window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
155 int id;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
156 void *signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
157 void *data;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
158
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
159 } SignalHandler;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
160
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
161 SignalHandler *Root = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
162
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
163 typedef struct
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
164 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
165 ULONG message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
166 char name[30];
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
167
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
168 } SignalList;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
169
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
170 /* 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
171 #define SIGNALMAX 16
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
172
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
173 SignalList SignalTranslate[SIGNALMAX] = {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
174 { WM_SIZE, DW_SIGNAL_CONFIGURE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
175 { WM_CHAR, DW_SIGNAL_KEY_PRESS },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
176 { WM_BUTTON1DOWN, DW_SIGNAL_BUTTON_PRESS },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
177 { WM_BUTTON1UP, DW_SIGNAL_BUTTON_RELEASE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
178 { WM_MOUSEMOVE, DW_SIGNAL_MOTION_NOTIFY },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
179 { WM_CLOSE, DW_SIGNAL_DELETE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
180 { WM_PAINT, DW_SIGNAL_EXPOSE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
181 { WM_COMMAND, DW_SIGNAL_CLICKED },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
182 { CN_ENTER, DW_SIGNAL_ITEM_ENTER },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
183 { CN_CONTEXTMENU, DW_SIGNAL_ITEM_CONTEXT },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
184 { LN_SELECT, DW_SIGNAL_LIST_SELECT },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
185 { CN_EMPHASIS, DW_SIGNAL_ITEM_SELECT },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
186 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
187 { SLN_SLIDERTRACK, DW_SIGNAL_VALUE_CHANGED },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
188 { BKN_PAGESELECTED,DW_SIGNAL_SWITCH_PAGE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
189 { CN_EXPANDTREE, DW_SIGNAL_TREE_EXPAND }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
190 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
191
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
192 /* 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
193 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
194 {
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
195 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
196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
197 GlobalID++;
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
198 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
199 {
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
200 GlobalID = 10000;
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
201 }
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
202 return GlobalID;
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
203 }
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
204
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
205 /* This function adds a signal handler callback into the linked list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
206 */
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
207 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
208 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
209 SignalHandler *new = malloc(sizeof(SignalHandler));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
210
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
211 new->message = message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
212 new->window = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
213 new->id = id;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
214 new->signalfunction = signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
215 new->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
216 new->next = NULL;
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 if (!Root)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
219 Root = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
220 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
221 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
222 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
223 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
224 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
225 if(tmp->message == message &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
226 tmp->window == window &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
227 tmp->id == id &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
228 tmp->signalfunction == signalfunction)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
229 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
230 tmp->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
231 free(new);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
232 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
233 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
234 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
235 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
236 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
237 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
238 prev->next = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
239 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
240 Root = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
241 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
242 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
243
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
244 /* Finds the message number for a given signal name */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
245 ULONG _findsigmessage(char *signame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
246 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
247 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
248
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
249 for(z=0;z<SIGNALMAX;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
250 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
251 if(stricmp(signame, SignalTranslate[z].name) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
252 return SignalTranslate[z].message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
253 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
254 return 0L;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
255 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
256
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
257 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
258 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
259 MINIRECORDCORE rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
260 HPOINTER hptrIcon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
261 PVOID user;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
262 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
263
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
264 } 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
265
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
266
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
267 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
268 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
269 window = window; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
270 key = key; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
271 data = data; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
272 return TRUE;
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
273 }
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
274
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
275 /* 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
276 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
277 {
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
278 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
279 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
280
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
281 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
282 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
283
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
284 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
285 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
286 {
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
287 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
288 }
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
289 }
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
290
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
291 /* 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
292 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
293 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
294 HWND box, lastbox = WinQueryWindow(handle, QW_PARENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
295
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
296 /* 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
297 while((box = WinQueryWindow(lastbox, QW_PARENT)) != desktop && box)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
298 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
299 lastbox = box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
300 }
1466
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
301 if(box)
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
302 {
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
303 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
304
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
305 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
306 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
307 return lastbox;
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
308 }
65986481a3d8 Rewrote _toplevel_window() on OS/2 so it is more accurate...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1459
diff changeset
309 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
310 }
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
311
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
312
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
313 /* 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
314 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
315 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
316 unsigned long height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
317 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
318 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
319 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
320
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
321 /* 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
322 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
323 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
324 while(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
325 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
326 HWND client;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
327 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
328 {
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
329 return _get_height(WinQueryWindow(handle, QW_PARENT));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
330 }
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
331 handle = WinQueryWindow(handle, QW_PARENT);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
332 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
333 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
334 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
335
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
336 /* 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
337 * 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
338 */
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
339 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
340 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
341 MRESULT res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
342 int z = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
343
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
344 while((int)(res = WinSendMsg(hwnd, msg, mp1, mp2)) == failure)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
345 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
346 z++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
347 if(z > 5000000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
348 return (MRESULT)failure;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
349 dw_main_sleep(1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
350 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
351 return res;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
352 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
353
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
354 /* 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
355 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
356 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
357 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
358 }
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
359
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
360 /* Return the entryfield child of a window */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
361 HWND _find_entryfield(HWND handle)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
362 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
363 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
364 HWND child, entry = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
365
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
366 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
367 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
368 {
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
369 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
370
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
371 WinQueryClassName(child, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
372
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
373 if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
374 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
375 entry = child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
376 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
377 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
378 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
379 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
380 return entry;
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
381 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
382
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
383 /* 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
384 * 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
385 */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
386 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
387 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
388 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
389 HWND child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
390
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
391 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
392 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
393 {
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
394 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
395
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
396 WinQueryClassName(child, 99, (PCH)tmpbuf);
643
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 if(strncmp(tmpbuf, "#3", 3)==0 && dw) /* Button */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
399 WinSetOwner(child, dw);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
400 else if(strncmp(tmpbuf, "dynamicwindows", 14) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
401 dw = child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
402
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
403 _fix_button_owner(child, dw);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
404 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
405 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
406 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
407 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
408
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
409 /* 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
410 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
411 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
412 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
413 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
414 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
415 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
416 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
417 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
418
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
419 if(icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
420 WinDestroyPointer(icon);
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 if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
423 dw_pixmap_destroy(pixmap);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
424
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
425 if(disable)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
426 dw_pixmap_destroy(disable);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
427
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
428 if(hps)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
429 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
430 GpiSetBitmap(hps, NULLHANDLE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
431 GpiAssociate(hps, NULLHANDLE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
432 GpiDestroyPS(hps);
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
435 if(hdc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
436 DevCloseDC(hdc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
437
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
438 if(hbm)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
439 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
440 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
441
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
442 /* This function removes any handlers on windows and frees
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
443 * the user memory allocated to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
444 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
445 void _free_window_memory(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
446 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
447 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
448 HWND child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
449 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
450
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
451 dw_signal_disconnect_by_window(handle);
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 if((child = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
454 _free_menu_data(child);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
455
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
456 if((child = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
457 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
458 Box *box = (Box *)WinQueryWindowPtr(child, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
459
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
460 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
461 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
462 if(box->count && box->items)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
463 free(box->items);
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 WinSetWindowPtr(child, QWP_USER, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
466 free(box);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
467 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
468 }
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 if(ptr)
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 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
473 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
474
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
475 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
476
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
477 if(strncmp(tmpbuf, "ColorSelectClass", 17)!=0)
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 /* If this window has an associate bitmap destroy it. */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
480 _free_bitmap(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
481
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
482 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
483 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
484 Box *box = (Box *)ptr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
485
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
486 if(box->count && box->items)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
487 free(box->items);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
488 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
489 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
490 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
491 void *data = dw_window_get_data(handle, "_dw_percent");
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 if(data)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
494 free(data);
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 else if(strncmp(tmpbuf, "#37", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
497 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
498 dw_container_clear(handle, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
499 if(wd && dw_window_get_data(handle, "_dw_container"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
500 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
501 void *oldflags = wd->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
502
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
503 wd->data = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
504 free(oldflags);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
505 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
506 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
507
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
508 if(wd->oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
509 WinSubclassWindow(handle, wd->oldproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
510
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
511 dw_window_set_data(handle, NULL, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
512 WinSetWindowPtr(handle, QWP_USER, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
513 free(ptr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
514 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
515 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
516
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
517 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
518 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
519 _free_window_memory(child);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
520
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
521 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
522 return;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
523 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
524
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
525 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
526 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
527 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
528
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
529 dw_signal_disconnect_by_name(menu, DW_SIGNAL_CLICKED);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
530 _free_window_memory(menu);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
531
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
532 for(i=0;i<count;i++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
533 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
534 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
535 MENUITEM mi;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
536
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
537 /* 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
538 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
539 {
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
540 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
541
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
542 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
543 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
544 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
545 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
546 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
547 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
548 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
549 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
550 }
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
551
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
552 /* Check any submenus */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
553 if(WinSendMsg(menu, MM_QUERYITEM, MPFROMSHORT(menuid), MPFROMP(&mi))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
554 && mi.hwndSubMenu)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
555 _free_menu_data(mi.hwndSubMenu);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
556 }
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
557 }
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
558
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
559 /* This function returns 1 if the window (widget) handle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
560 * passed to it is a valid window that can gain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
561 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
562 int _validate_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
563 {
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
564 char tmpbuf[100] = {0};
643
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(!handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
567 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
568
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
569 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
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 if(!WinIsWindowEnabled(handle) ||
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
572 (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
573 return 0;
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 /* These are the window classes which can
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
576 * obtain input focus.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
577 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
578 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
579 strncmp(tmpbuf, "#3", 3)==0 || /* Button */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
580 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
581 strncmp(tmpbuf, "#7", 3)==0 || /* List box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
582 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
583 strncmp(tmpbuf, "#32", 4)==0 || /* Spinbutton */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
584 strncmp(tmpbuf, "#37", 4)==0 || /* Container */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
585 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
586 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
587 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
588 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
589
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
590 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
591 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
592 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
593 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
594 static int finish_searching;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
595
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
596 /* Start is 2 when we have cycled completely and
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
597 * 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
598 * that was valid.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
599 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
600 if(start == 2)
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(lasthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
603 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
604 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
605 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
606
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
607 /* Start is 1 when we are entering the function
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
608 * for the first time, it is zero when entering
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
609 * the function recursively.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
610 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
611 if(start == 1)
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 lasthwnd = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
614 finish_searching = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
615 firsthwnd = 0;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
618 for(z=box->count-1;z>-1;z--)
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 if(box->items[z].type == TYPEBOX)
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 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
623
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
624 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
625 return 1;
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 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
629 if(box->items[z].hwnd == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
630 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
631 if(lasthwnd == handle && firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
632 WinSetFocus(HWND_DESKTOP, firsthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
633 else if(lasthwnd == handle && !firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
634 finish_searching = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
635 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
636 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
637
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
638 /* If we aren't looking for the last handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
639 * return immediately.
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(!finish_searching)
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 if(_validate_focus(box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
645 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
646 /* Start is 3 when we are looking for the
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
647 * first valid item in the layout.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
648 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
649 if(start == 3)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
650 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
651 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
652 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
653 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
654 return 1;
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 }
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 if(!firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
659 firsthwnd = box->items[z].hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
660
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
661 lasthwnd = box->items[z].hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
662 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
663 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
664 {
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
665 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
666
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
667 WinQueryClassName(box->items[z].hwnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
668 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
669 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
670 /* Then try the bottom or right box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
671 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
672
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
673 if(mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
674 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
675 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
676
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
677 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
678 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
679 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
680
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
681 /* Try the top or left box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
682 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
683
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
684 if(mybox)
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 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
687
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
688 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
689 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
690 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
691 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
692 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
693 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
694 Box *notebox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
695 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
696 (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
697
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
698 if(page)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
699 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
700 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
701
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
702 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
703 return 1;
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 }
904
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
706 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
707 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
708 /* 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
709 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
710
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
711 if(mybox)
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
712 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
713 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
714
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
715 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
716 return 1;
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
717 }
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
718 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
719 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
720 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
721 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
722 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
723 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
724
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
725 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
726 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
727 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
728 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
729 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
730
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
731 /* Start is 2 when we have cycled completely and
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
732 * 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
733 * that was valid.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
734 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
735 if(start == 2)
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(lasthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
738 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
739 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
740 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
741
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
742 /* Start is 1 when we are entering the function
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
743 * for the first time, it is zero when entering
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
744 * the function recursively.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
745 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
746 if(start == 1)
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 lasthwnd = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
749 finish_searching = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
750 firsthwnd = 0;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
753 for(z=0;z<box->count;z++)
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 if(box->items[z].type == TYPEBOX)
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 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
758
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
759 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
760 return 1;
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 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
764 if(box->items[z].hwnd == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
765 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
766 if(lasthwnd == handle && firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
767 WinSetFocus(HWND_DESKTOP, firsthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
768 else if(lasthwnd == handle && !firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
769 finish_searching = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
770 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
771 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
772
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
773 /* If we aren't looking for the last handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
774 * return immediately.
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(!finish_searching)
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 if(_validate_focus(box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
780 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
781 /* Start is 3 when we are looking for the
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
782 * first valid item in the layout.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
783 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
784 if(start == 3)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
785 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
786 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
787 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
788 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
789 return 1;
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 }
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 if(!firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
794 firsthwnd = box->items[z].hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
795
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
796 lasthwnd = box->items[z].hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
797 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
798 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
799 {
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
800 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
801
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
802 WinQueryClassName(box->items[z].hwnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
803 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
804 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
805 /* Try the top or left box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
806 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
807
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
808 if(mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
809 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
810 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
811
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
812 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
813 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
814 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
815
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
816 /* Then try the bottom or right box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
817 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
818
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
819 if(mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
820 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
821 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
822
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
823 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
824 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
825 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
826 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
827 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
828 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
829 Box *notebox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
830 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
831 (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
832
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
833 if(page)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
834 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
835 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
836
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
837 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
838 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
839 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
840 }
904
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
841 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
842 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
843 /* 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
844 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
845
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
846 if(mybox)
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
847 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
848 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
849
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
850 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
851 return 1;
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
852 }
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
853 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
854 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
855 }
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 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
858 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
859
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
860 /* This function finds the first widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
861 * layout and moves the current focus to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
862 */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
863 int _initial_focus(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
864 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
865 Box *thisbox = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
866 HWND box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
867
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
868 box = WinWindowFromID(handle, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
869 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
870 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
871 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
872 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
873
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
874 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
875 _focus_check_box(thisbox, handle, 3, thisbox->defaultitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
876 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
877 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
878
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
879 /* This function finds the current widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
880 * layout and moves the current focus to the next item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
881 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
882 void _shift_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
883 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
884 Box *thisbox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
885 HWND box, lastbox = _toplevel_window(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
886
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
887 box = WinWindowFromID(lastbox, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
888 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
889 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
890 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
891 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
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 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
894 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
895 if(_focus_check_box(thisbox, handle, 1, 0) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
896 _focus_check_box(thisbox, handle, 2, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
897 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
898 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
899
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
900 /* 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
901 * 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
902 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
903 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
904 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
905 Box *thisbox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
906 HWND box, lastbox = _toplevel_window(handle);
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 box = WinWindowFromID(lastbox, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
909 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
910 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
911 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
912 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
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 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
915 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
916 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
917 _focus_check_box_back(thisbox, handle, 2, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
918 }
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
919 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
920
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
921 /* This function will recursively search a box and add up the total height of it */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
922 void _count_size(HWND box, int type, int *xsize, int *xorigsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
923 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
924 int size = 0, origsize = 0, z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
925 Box *tmp = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
926
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
927 if(!tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
928 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
929 *xsize = *xorigsize = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
930 return;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
933 if(type == tmp->type)
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 /* 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
936 * return the entire sum of the items.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
937 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
938 for(z=0;z<tmp->count;z++)
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 if(tmp->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
941 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
942 int s, os;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
943
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
944 _count_size(tmp->items[z].hwnd, type, &s, &os);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
945 size += s;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
946 origsize += os;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
947 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
948 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
949 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
950 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
951 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
952 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
953 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
954 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
955 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
956 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
957 /* 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
958 * want to return the maximum value.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
959 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
960 int tmpsize = 0, tmporigsize = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
961
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
962 for(z=0;z<tmp->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
963 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
964 if(tmp->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
965 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
966 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
967 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
968 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
969 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
970 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
971
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
972 if(tmpsize > size)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
973 size = tmpsize;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
976
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
977 *xsize = size;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
978 *xorigsize = origsize;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
979 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
980
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
981
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
982 /* Function: TrackRectangle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
983 * Abstract: Tracks given rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
984 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
985 * If rclBounds is NULL, then track rectangle on entire desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
986 * rclTrack is in window coorditates and will be mapped to
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
987 * desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
988 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
989
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
990 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
991 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
992 TRACKINFO track;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
993 APIRET rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
994
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
995 track.cxBorder = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
996 track.cyBorder = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
997 track.cxGrid = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
998 track.cyGrid = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
999 track.cxKeyboard = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1000 track.cyKeyboard = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1001
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1002 if(!rclTrack)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1003 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1004
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1005 if(rclBounds)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1006 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1007 track.rclBoundary = *rclBounds;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1008 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1009 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1010 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1011 track.rclBoundary.yTop =
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1012 track.rclBoundary.xRight = 3000;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1013 track.rclBoundary.yBottom =
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1014 track.rclBoundary.xLeft = -3000;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1015 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1016
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1017 track.rclTrack = *rclTrack;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1018
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1019 WinMapWindowPoints(hwndBase,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1020 HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1021 (PPOINTL)&track.rclTrack,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1022 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1023
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1024 track.ptlMinTrackSize.x = track.rclTrack.xRight
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1025 - track.rclTrack.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1026 track.ptlMinTrackSize.y = track.rclTrack.yTop
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1027 - track.rclTrack.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1028 track.ptlMaxTrackSize.x = track.rclTrack.xRight
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1029 - track.rclTrack.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1030 track.ptlMaxTrackSize.y = track.rclTrack.yTop
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1031 - track.rclTrack.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1032
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1033 track.fs = TF_MOVE | TF_ALLINBOUNDARY;
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 rc = WinTrackRect(HWND_DESKTOP, 0, &track);
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 if(rc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1038 *rclTrack = track.rclTrack;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1039
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1040 return rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1041 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
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 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
1044 {
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
1045 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1046
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
1047 WinQueryClassName(hwnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1048
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1049 /* 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
1050 if(strncmp(tmpbuf, "#40", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1051 {
822
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
1052 long x, y;
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
1053 unsigned long width, height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1054 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
1055
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1056 while(page)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1057 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1058 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
1059 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1060
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1061 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1062 if(pagebox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1063 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1064 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
1065
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1066 rc.xLeft = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1067 rc.yBottom = y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1068 rc.xRight = x + width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1069 rc.yTop = y + height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1070
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1071 WinSendMsg(hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1072
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1073 _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
1074 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1075 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
1076 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1077
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1078 }
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1079 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1080
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
1081 /* 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
1082 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
1083 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1084 if(color < 16)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1085 return _colors[color];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1086 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
1087 }
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
1088
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
1089 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
1090 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1091 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
1092 }
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
1093
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1094 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
1095 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1096 int height = _get_height(parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1097
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1098 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
1099 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1100
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1101 /* This function calculates how much space the widgets and boxes require
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1102 * and does expansion as necessary.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1103 */
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
1104 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
1105 {
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1106 /* 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
1107 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
1108 /* 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
1109 * 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
1110 * 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
1111 */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1112 int uymax = 0, uxmax = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1113 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
1114
bde7ebced556 Initial layout engine 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 /* 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
1116 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
1117
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1118 if(thisbox->grouphwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1119 {
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
1120 /* 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
1121 * 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
1122 */
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
1123 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
1124 {
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
1125 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
1126
1409
93eb987c05cf Same basic groupbox fix for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1407
diff changeset
1127 thisbox->grouppady = 9;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1128
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
1129 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
1130 {
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
1131 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
1132 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
1133 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
1134 }
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
1135 /* 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
1136 * 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
1137 */
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
1138 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
1139 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
1140
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
1141 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
1142 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
1143 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
1144 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
1145
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
1146 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
1147 }
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
1148
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
1149 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
1150 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
1151 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
1152 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
1153 }
bde7ebced556 Initial layout engine 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
bde7ebced556 Initial layout engine 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 /* 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
1156 for(z=0;z<thisbox->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1157 {
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
1158 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
1159
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1160 if(thisbox->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1161 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1162 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1163
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1164 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1165 {
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
1166 /* 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
1167 if(pass == 1)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1168 {
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
1169 (*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
1170
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1171 /* 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
1172 _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
1173
bde7ebced556 Initial layout engine 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 /* 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
1175 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
1176 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
1177
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
1178 /* 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
1179 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
1180 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
1181 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
1182 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
1183
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
1184 (*depth)--;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1185 }
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
1186 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1187 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1188
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1189 /* 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
1190 * 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
1191 */
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1192 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
1193 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
1194 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
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 /* Calculate the totals and maximums */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1197 if(thisbox->type == DW_VERT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1198 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1199 if(itemwidth > uxmax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1200 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
1201
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1202 if(thisbox->items[z].hsize != SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1203 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1204 if(itemwidth > upxmax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1205 upxmax = itemwidth;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1206 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1207 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1208 {
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
1209 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
1210 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
1211 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1212 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
1213 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
1214 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
1215 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
1216 thisbox->usedpady += itempad;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1217 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1218 else
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 if(itemheight > uymax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1221 uymax = itemheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1222 if(thisbox->items[z].vsize != SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1223 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1224 if(itemheight > upymax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1225 upymax = itemheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1226 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1227 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1228 {
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
1229 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
1230 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
1231 }
bde7ebced556 Initial layout engine 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 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
1233 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
1234 thisbox->usedpadx += itemwidth;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1235 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
1236 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
1237 }
bde7ebced556 Initial layout engine 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 }
bde7ebced556 Initial layout engine 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 /* 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
1241 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
1242 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
1243 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
1244 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
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 /* Move the groupbox start past the group border */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1247 if(thisbox->grouphwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1248 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1249 currentx += 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1250 currenty += thisbox->grouppady - 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1251 }
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
1252
bde7ebced556 Initial layout engine 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 /* The second pass is for actual placement. */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1254 if(pass > 1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1255 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1256 for(z=0;z<(thisbox->count);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1257 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1258 int height = thisbox->items[z].height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1259 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
1260 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
1261 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
1262
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1263 /* 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
1264 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
1265 {
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1266 if(thisbox->type == DW_HORZ)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1267 {
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
1268 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
1269
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1270 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
1271 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
1272 }
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
1273 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
1274 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
1275 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1276 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
1277 {
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1278 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
1279 {
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 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
1281
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1282 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
1283 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
1284 }
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
1285 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
1286 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
1287 }
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
1288
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
1289 /* 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
1290 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
1291 {
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1292 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
1293 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
1294 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
1295
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
1296 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1297
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1298 if(strncmp(tmpbuf, "#2", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1299 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1300 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
1301 /* Make the combobox big enough to drop down. :) */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1302 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
1303 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
1304 _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
1305 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1306 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1307 else if(strncmp(tmpbuf, "#6", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1308 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1309 /* 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
1310 _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
1311 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
1312 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1313 else if(strncmp(tmpbuf, "#40", 5)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1314 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1315 _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
1316 width, height, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1317 _check_resize_notebook(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1318 }
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1319 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
1320 {
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1321 /* 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
1322 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
1323 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
1324 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
1325 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
1326 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
1327 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
1328 int origx, origy;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1329 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
1330 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
1331
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1332 /* 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
1333 _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
1334 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
1335 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
1336 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
1337
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
1338 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
1339 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
1340
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1341 /* 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
1342 _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
1343
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1344 if(cx < contentbox->minwidth)
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1345 {
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
1346 cx = contentbox->minwidth;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1347 }
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
1348 if(cy < contentbox->minheight)
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1349 {
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 cy = contentbox->minheight;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1351 }
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1352
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1353 /* 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
1354 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
1355 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
1356 if(vpos > contentbox->minheight)
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1357 {
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
1358 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
1359 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
1360 }
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
1361
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1362 /* 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
1363 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
1364 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
1365 if(hpos > contentbox->minwidth)
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1366 {
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
1367 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
1368 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
1369 }
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
1370
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1371 /* 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
1372 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
1373
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
1374 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
1375
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1376 /* 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
1377 _do_resize(contentbox, cx, cy);
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1378 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1379 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
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 /* Then try the bottom or right box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1382 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
1383 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
1384
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1385 _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
1386 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
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 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
1389 _handle_splitbar_resize(handle, *percent, type, width, height);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1390 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1391 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1392 {
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
1393 /* Everything else */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1394 _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
1395 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
1396
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1397 /* After placing a box... place its components */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1398 if(thisbox->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1399 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1400 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1401
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
1402 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
1403 {
bde7ebced556 Initial layout engine 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 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
1405 {
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1406 /* 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
1407 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
1408 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
1409 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1410 /* 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
1411 (*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
1412 _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
1413 (*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
1414 }
643
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1417
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
1418 /* Advance the current position in the box */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1419 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
1420 currentx += width + (pad * 2);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1421 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
1422 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
1423 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1424 }
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1425 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1426 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1427
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1428 void _do_resize(Box *thisbox, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1429 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1430 if(x != 0 && y != 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1431 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1432 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1433 {
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
1434 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
1435
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
1436 /* 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
1437 _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
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
1439 /* 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
1440 _resize_box(thisbox, &depth, x, y, 2);
643
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 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1443 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1444
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1445 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1446 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1447 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1448 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1449 Box *thisbox = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1450 HWND box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1451
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1452 box = WinWindowFromID(hWnd, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1453 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1454 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1455
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1456 if(thisbox && !thisbox->titlebar)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1457 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1458 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1459 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1460 case WM_QUERYTRACKINFO:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1461 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1462 if(blah && *blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1463 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1464 PTRACKINFO ptInfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1465 int res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1466 PFNWP myfunc = *blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1467 res = (int)myfunc(hWnd, msg, mp1, mp2);
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 ptInfo = (PTRACKINFO)(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1470
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1471 ptInfo->ptlMinTrackSize.y = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1472 ptInfo->ptlMinTrackSize.x = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1473
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1474 return (MRESULT)res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1475 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1476 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1477 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1478 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1479
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1480 if(blah && *blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1481 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1482 PFNWP myfunc = *blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1483 return myfunc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1484 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1485
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1486 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1487 }
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1488
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1489 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
1490 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1491 POINTL ptl1, ptl2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1492
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1493 ptl1.x = rclPaint.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1494 ptl2.y = ptl1.y = rclPaint.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1495 ptl2.x = rclPaint.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1496 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1497 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
1498 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1499
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1500 /* 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
1501 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
1502 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1503 POINTL ptl1, ptl2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1504
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1505 ptl2.x = ptl1.x = rclPaint.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1506 ptl1.y = rclPaint.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1507 ptl2.y = rclPaint.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1508 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1509 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
1510 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1511
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1512 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
1513 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1514 POINTL ptl1, ptl2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1515
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1516 ptl1.x = rclPaint.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1517 ptl1.y = ptl2.y = rclPaint.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1518 ptl2.x = rclPaint.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1519 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1520 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
1521 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1522
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1523 /* 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
1524 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
1525 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1526 POINTL ptl1, ptl2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1527
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1528 ptl2.x = ptl1.x = rclPaint.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1529 ptl1.y = rclPaint.yBottom + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1530 ptl2.y = rclPaint.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1531 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1532 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
1533 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1534
1691
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1535 void _drawtext(HWND hWnd, HPS hpsPaint)
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1536 {
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1537 RECTL rclPaint;
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1538 int len = WinQueryWindowTextLength(hWnd);
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1539 ULONG style = WinQueryWindowULong(hWnd, QWL_STYLE) & (DT_TOP|DT_VCENTER|DT_BOTTOM|DT_LEFT|DT_CENTER|DT_RIGHT|DT_WORDBREAK);
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1540 char *tempbuf = alloca(len + 2);
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1541 ULONG fcolor = DT_TEXTATTRS, bcolor = DT_TEXTATTRS;
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1542
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1543 WinQueryWindowText(hWnd, len + 1, (PSZ)tempbuf);
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1544 WinQueryWindowRect(hWnd, &rclPaint);
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1545
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1546 if(WinQueryPresParam(hWnd, PP_BACKGROUNDCOLOR, 0, NULL, sizeof(bcolor), &bcolor, QPF_NOINHERIT) ||
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1547 WinQueryPresParam(hWnd, PP_BACKGROUNDCOLORINDEX, 0, NULL, sizeof(bcolor), &bcolor, QPF_NOINHERIT))
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1548 GpiSetBackColor(hpsPaint, bcolor);
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1549 if(WinQueryPresParam(hWnd, PP_FOREGROUNDCOLOR, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT) ||
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1550 WinQueryPresParam(hWnd, PP_FOREGROUNDCOLORINDEX, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT))
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1551 GpiSetColor(hpsPaint, fcolor);
1692
6e26c9ead2fe Fixed a variety of warnings in different compiler/linker combinations on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1691
diff changeset
1552 WinDrawText(hpsPaint, -1, (PCH)tempbuf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT);
1691
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1553 }
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1554
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1555 /* Function: BubbleProc
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1556 * Abstract: Subclass procedure for bubble help
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1557 */
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1558 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
1559 {
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1560 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
1561
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1562 if(msg == WM_PAINT)
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1563 {
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1564 POINTL ptl;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1565 HPS hpsTemp;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1566 RECTL rcl;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1567 int height, width;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1568
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1569 WinQueryWindowRect(hwnd, &rcl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1570 height = rcl.yTop - rcl.yBottom - 1;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1571 width = rcl.xRight - rcl.xLeft - 1;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1572
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1573 /* Draw a border around the bubble help */
1691
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1574 hpsTemp = WinBeginPaint(hwnd, 0, 0);
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1575
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1576 _drawtext(hwnd, hpsTemp);
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1577 GpiSetColor(hpsTemp, CLR_BLACK);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1578 ptl.x = ptl.y = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1579 GpiMove(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1580 ptl.x = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1581 ptl.y = height;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1582 GpiLine(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1583 ptl.x = ptl.y = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1584 GpiMove(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1585 ptl.y = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1586 ptl.x = width;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1587 GpiLine(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1588 ptl.x = width;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1589 ptl.y = height;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1590 GpiMove(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1591 ptl.x = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1592 ptl.y = height;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1593 GpiLine(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1594 ptl.x = width;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1595 ptl.y = height;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1596 GpiMove(hpsTemp, &ptl);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1597 ptl.y = 0;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1598 ptl.x = width;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1599 GpiLine(hpsTemp, &ptl);
1691
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1600 WinEndPaint(hpsTemp);
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1601 return (MRESULT)TRUE;
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1602 }
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1603 if(proc)
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1604 return proc(hwnd, msg, mp1, mp2);
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
1605 return WinDefWindowProc(hwnd, msg, mp1, mp2);
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1606 }
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1607
1736
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1608 /* Subclass WC_STATIC to draw a bitmap centered */
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1609 MRESULT EXPENTRY _BitmapProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1610 {
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1611 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWL_USER);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1612
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1613 if(msg == WM_PAINT)
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1614 {
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1615 HPS hps = WinBeginPaint(hwnd, 0, 0);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1616 HBITMAP hbm = (HBITMAP)dw_window_get_data(hwnd, "_dw_bitmap");
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1617 RECTL rcl;
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1618
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1619 WinQueryWindowRect(hwnd, &rcl) ;
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1620 WinFillRect(hps, &rcl, CLR_PALEGRAY);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1621
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1622 /* If we have a bitmap... draw it */
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1623 if(hbm)
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1624 {
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1625 BITMAPINFOHEADER sl;
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1626
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1627 sl.cbFix = sizeof(BITMAPINFOHEADER);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1628
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1629 /* Check the bitmap size */
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1630 if(GpiQueryBitmapParameters(hbm, &sl))
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1631 {
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1632 /* Figure out the window size before clobbering the data */
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1633 int width = rcl.xRight - rcl.xLeft, height = rcl.yTop - rcl.yBottom;
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1634
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1635 /* If the control is bigger than the bitmap, center it */
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1636 if(width > sl.cx)
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1637 rcl.xLeft = (width-sl.cx)/2;
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1638 if(height > sl.cy)
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1639 rcl.yBottom = (height-sl.cy)/2;
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1640
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1641 }
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1642 /* Draw the bitmap unscaled at the desired location */
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1643 WinDrawBitmap(hps, hbm, NULL, (PPOINTL) &rcl,
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1644 CLR_NEUTRAL, CLR_BACKGROUND, DBM_NORMAL);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1645 }
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1646
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1647 WinEndPaint(hps);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1648 return 0;
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1649 }
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1650 if(blah && blah->oldproc)
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1651 return blah->oldproc(hwnd, msg, mp1, mp2);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1652 return WinDefWindowProc(hwnd, msg, mp1, mp2);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1653 }
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
1654
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1655 /* 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
1656 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
1657 {
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
1658 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
1659
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
1660 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
1661 {
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
1662 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
1663 /* 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
1664 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
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 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
1667 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
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 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
1670 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
1671 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
1672 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
1673 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
1674 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
1675
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 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
1677 /* 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
1678 * 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
1679 */
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 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
1681 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
1682 /* 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
1683 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
1684 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
1685 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
1686 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
1687 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
1688 {
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
1689 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
1690 {
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
1691 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
1692 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
1693 }
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
1694 /* 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
1695 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
1696 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
1697 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
1698 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
1699 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
1700 /* 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
1701 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
1702 {
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
1703 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
1704 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
1705 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
1706 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
1707 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
1708 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
1709 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
1710
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
1711 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
1712 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
1713 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
1714 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
1715 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
1716 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
1717 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
1718 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
1719 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
1720 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
1721 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
1722 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
1723 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
1724
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
1725 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
1726 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
1727 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
1728 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
1729
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
1730
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
1731 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
1732 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
1733 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
1734 &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
1735
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
1736 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
1737 (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
1738
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
1739 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
1740
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
1741 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
1742 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
1743 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
1744 (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
1745 TXTBOX_COUNT,
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1746 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
1747 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
1748
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
1749 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
1750 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
1751
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
1752 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
1753 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
1754
1507
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1755 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
1756
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1757 /* 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
1758 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
1759 {
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1760 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
1761 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
1762 ptlWork.x = 0;
fbe9028af341 Make sure OS/2 tooltips are visible on the screen.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1504
diff changeset
1763 }
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
1764
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
1765 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
1766
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
1767 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
1768 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
1769
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
1770 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
1771 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
1772 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
1773 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
1774 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
1775 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
1776 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
1777
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
1778 /* 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
1779 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
1780 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
1781 }
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
1782 }
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
1783 break;
1404
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
1784 }
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
1785 return (MRESULT)FALSE;
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1786 }
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1787
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1788 #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
1789 #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
1790
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1791 /* 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
1792 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
1793 {
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1794 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
1795 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
1796 /* 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
1797 * 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
1798 */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1799 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
1800 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
1801 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
1802 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
1803
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1804 /* 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
1805 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
1806 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
1807 /* 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
1808 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
1809 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
1810 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
1811 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1812
1591
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
1813 /* 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
1814 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
1815 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
1816
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1817 /* 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
1818 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
1819 {
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
1820 /* 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
1821 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
1822 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
1823 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
1824
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1825 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
1826 {
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1827 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
1828
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1829 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1830 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
1831
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1832 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
1833 {
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
1834 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
1835 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
1836 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
1837 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1838 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
1839 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
1840 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
1841 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
1842 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
1843 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
1844 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
1845
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1846 /* 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
1847 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
1848 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
1849 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
1850 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
1851
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1852 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
1853 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
1854
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1855 /* 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
1856 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
1857 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
1858 {
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
1859 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
1860
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1861 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
1862 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1863 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
1864 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
1865 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
1866 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1867 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
1868 {
1436bcd68ee4 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 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
1870 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1871 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
1872 /* 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
1873 * 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
1874 */
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
1875 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
1876 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
1877 {
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
1878 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
1879 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
1880 }
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 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
1882 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
1883 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
1884 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1885
1436bcd68ee4 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 /* 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
1887 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
1888 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
1889 {
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
1890 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
1891
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
1892 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
1893 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1894 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
1895 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
1896 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
1897 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1898 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
1899 {
1436bcd68ee4 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 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
1901 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1902 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
1903 /* 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
1904 * 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
1905 */
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
1906 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
1907 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
1908 {
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
1909 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
1910 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
1911 }
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
1912 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
1913 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
1914 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
1915 }
1436bcd68ee4 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
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1917 /* 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
1918 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
1919 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1920 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
1921 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
1922 {
1436bcd68ee4 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 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
1924 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
1925 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
1926 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
1927 }
1436bcd68ee4 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 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1930 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
1931 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
1932 {
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1933 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
1934 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
1935 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
1936 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
1937 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
1938 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
1939 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
1940 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
1941
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1942 /* 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
1943 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
1944 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
1945
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1946 /* 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
1947 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
1948
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1949 /* 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
1950 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
1951 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
1952 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
1953 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
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 /* 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
1956 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
1957 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
1958 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
1959 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
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 /* 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
1962 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
1963 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
1964 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
1965 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
1966
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1967 /* 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
1968 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
1969 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
1970 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
1971 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
1972 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
1973 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
1974 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
1975 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
1976 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
1977 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
1978 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
1979
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1980 /* 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
1981 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
1982 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
1983 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
1984 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
1985 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
1986 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
1987 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
1988 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
1989 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
1990 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
1991
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1992 /* 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
1993 _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
1994 _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
1995 /* 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
1996 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
1997 _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
1998 _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
1999
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2000 /* 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
2001 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
2002 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
2003 {
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
2004 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
2005
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2006 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
2007
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
2008 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
2009 {
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
2010 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
2011 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
2012 }
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
2013 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
2014 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2015
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2016 /* 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
2017 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
2018 {
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
2019 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
2020 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
2021
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2022 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
2023 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
2024 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
2025 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
2026 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
2027 }
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
2028 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
2029 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
2030 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
2031 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
2032 }
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2033 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
2034 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
2035 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
2036 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
2037 }
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2038 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
2039 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2040
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2041 /* 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
2042 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
2043 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
2044 _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
2045 _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
2046 /* 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
2047 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
2048 _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
2049 _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
2050
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2051 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
2052
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2053 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
2054 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2055 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2056 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
2057 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
2058 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2059
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2060 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
2061 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2062
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
2063
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2064 /* This procedure handles drawing of a status border */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2065 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
2066 {
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2067 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
2068 PFNWP oldproc = 0;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2069
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2070 if(msg == WM_MOUSEMOVE && _wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2071 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2072
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2073 if(blah)
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2074 {
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2075 oldproc = blah->oldproc;
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2076
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2077 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2078 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2079
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2080 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2081 _TooltipProc(hWnd, msg, mp1, mp2, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2082
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2083 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2084 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2085 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2086 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2087 HPS hpsPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2088 RECTL rclPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2089 char buf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2090
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2091 hpsPaint = WinBeginPaint(hWnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2092 WinQueryWindowRect(hWnd, &rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2093 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2094
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2095 GpiSetColor(hpsPaint, CLR_DARKGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2096 _Top(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2097 _Left(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2098
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2099 GpiSetColor(hpsPaint, CLR_WHITE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2100 _Right(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2101 _Bottom(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2102
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2103 WinQueryWindowText(hWnd, 1024, (PSZ)buf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2104 rclPaint.xLeft += 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2105 rclPaint.xRight--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2106 rclPaint.yTop--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2107 rclPaint.yBottom++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2108
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2109 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
2110 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
2111 WinEndPaint(hpsPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2112
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2113 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2114 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2115 }
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2116 if(oldproc)
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2117 return oldproc(hWnd, msg, mp1, mp2);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2118 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2119
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2120 return WinDefWindowProc(hWnd, msg, mp1, mp2);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2121 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2122
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
2123 /* 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
2124 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
2125 {
1520
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2126 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
2127
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2128 if(blah && blah->bubbletext[0])
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2129 _TooltipProc(hWnd, msg, mp1, mp2, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2130
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2131 if(msg == WM_MOUSEMOVE &&_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2132 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2133
1520
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2134 if(blah && blah->oldproc)
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2135 {
65861fedc4b4 Enable tooltips on text controls on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1507
diff changeset
2136 PFNWP myfunc = blah->oldproc;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2137
1687
831aa3a679e6 Gr... messed up tabs in the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1686
diff changeset
2138 switch(msg)
831aa3a679e6 Gr... messed up tabs in the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1686
diff changeset
2139 {
831aa3a679e6 Gr... messed up tabs in the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1686
diff changeset
2140 case WM_PAINT:
831aa3a679e6 Gr... messed up tabs in the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1686
diff changeset
2141 {
1691
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
2142 HPS hpsPaint = WinBeginPaint(hWnd, 0, 0);
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
2143
0bf394615372 Fixed bubble help/tooltips with UTF-8 encoded characters on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1690
diff changeset
2144 _drawtext(hWnd, hpsPaint);
1687
831aa3a679e6 Gr... messed up tabs in the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1686
diff changeset
2145 WinEndPaint(hpsPaint);
831aa3a679e6 Gr... messed up tabs in the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1686
diff changeset
2146 return (MRESULT)TRUE;
831aa3a679e6 Gr... messed up tabs in the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1686
diff changeset
2147 }
831aa3a679e6 Gr... messed up tabs in the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1686
diff changeset
2148 default:
831aa3a679e6 Gr... messed up tabs in the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1686
diff changeset
2149 return myfunc(hWnd, msg, mp1, mp2);
831aa3a679e6 Gr... messed up tabs in the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1686
diff changeset
2150 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2151 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2152
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2153 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
2154 }
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
2155
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
2156 /* This procedure handles scrollbox */
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
2157 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
2158 {
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2159 switch(msg)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2160 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2161 case WM_PAINT:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2162 {
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
2163 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
2164 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
2165
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
2166 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
2167 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
2168 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
2169 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
2170 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2171 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2172 case WM_HSCROLL:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2173 case WM_VSCROLL:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2174 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2175 MPARAM res;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2176 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
2177 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
2178 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
2179 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
2180 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
2181 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
2182 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
2183 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
2184 RECTL rect;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2185
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2186 WinQueryWindowRect(client, &rect);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2187
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2188 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
2189 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2190 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
2191 handle = vscroll;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2192 pos = &vpos;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2193 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2194 else
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2195 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2196 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
2197 handle = hscroll;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2198 pos = &hpos;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2199 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2200
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2201 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
2202 min = SHORT1FROMMP(res);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2203 max = SHORT2FROMMP(res);
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2204
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2205 switch(which)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2206 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2207 case SB_SLIDERTRACK:
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2208 *pos = SHORT1FROMMP(mp2);
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2209 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2210 case SB_LINEUP:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2211 (*pos)--;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2212 if(*pos < min)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2213 *pos = min;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2214 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2215 case SB_LINEDOWN:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2216 (*pos)++;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2217 if(*pos > max)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2218 *pos = max;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2219 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2220 case SB_PAGEUP:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2221 (*pos) -= page;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2222 if(*pos < min)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2223 *pos = min;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2224 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2225 case SB_PAGEDOWN:
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2226 (*pos) += page;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2227 if(*pos > max)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2228 *pos = max;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2229 break;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2230 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2231 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
2232 /* 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
2233 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
2234 break;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2235 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2236 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
2237 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
2238 }
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
2239
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2240 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
2241 {
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
2242 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2243
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2244 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
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 /* These are the window classes which can
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2247 * obtain input focus.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2248 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2249 if(strncmp(tmpbuf, "#3", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2250 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2251 /* Generate click on default item */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2252 SignalHandler *tmp = Root;
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 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2255 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2256 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2257 if(tmp->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2258 {
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
2259 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
2260
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2261 /* 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
2262 if(tmp->window == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2263 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2264 clickfunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2265 tmp = NULL;
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 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2269 tmp= tmp->next;
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2273 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
2274 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2275
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
2276 #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
2277 #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
2278 #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
2279 #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
2280 #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
2281
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2282 /* Originally just intended for entryfields, it now serves as a generic
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2283 * procedure for handling TAB presses to change input focus on controls.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2284 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2285 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2286 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2287 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2288 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
2289 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2290
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2291 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2292 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2293
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2294 WinQueryClassName(hWnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2295
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2296 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2297 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2298
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2299 /* 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
2300 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2301 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2302 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2303 strncmp(tmpbuf, "#32", 4)==0) /* Spinbutton */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2304 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2305 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2306 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2307 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2308 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2309 HMENUI hwndMenu = dw_menu_new(0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2310 long x, y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2311
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2312 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
2313 {
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
2314 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
2315 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
2316 }
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
2317 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
2318 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
2319 {
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
2320 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
2321 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
2322 }
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
2323 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
2324 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
2325
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2326 WinSetFocus(HWND_DESKTOP, hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2327 dw_pointer_query_pos(&x, &y);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2328 dw_menu_popup(&hwndMenu, hWnd, x, y);
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 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2331 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2332 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2333 ULONG command = COMMANDMSG(&msg)->cmd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2334
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2335 /* MLE */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2336 if(strncmp(tmpbuf, "#10", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2337 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2338 switch(command)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2339 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2340 case ENTRY_CUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2341 return WinSendMsg(hWnd, MLM_CUT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2342 case ENTRY_COPY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2343 return WinSendMsg(hWnd, MLM_COPY, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2344 case ENTRY_PASTE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2345 return WinSendMsg(hWnd, MLM_PASTE, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2346 case ENTRY_UNDO:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2347 return WinSendMsg(hWnd, MLM_UNDO, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2348 case ENTRY_SALL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2349 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2350 ULONG len = (ULONG)WinSendMsg(hWnd, MLM_QUERYTEXTLENGTH, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2351 return WinSendMsg(hWnd, MLM_SETSEL, 0, (MPARAM)len);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2352 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2353 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2354 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2355 else /* Other */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2356 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2357 HWND handle = hWnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2358
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2359 /* Get the entryfield handle from multi window controls */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2360 if(strncmp(tmpbuf, "#2", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2361 handle = WinWindowFromID(hWnd, 667);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2362
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2363 if(handle)
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 switch(command)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2366 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2367 case ENTRY_CUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2368 return WinSendMsg(handle, EM_CUT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2369 case ENTRY_COPY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2370 return WinSendMsg(handle, EM_COPY, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2371 case ENTRY_PASTE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2372 return WinSendMsg(handle, EM_PASTE, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2373 case ENTRY_SALL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2374 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2375 LONG len = WinQueryWindowTextLength(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2376 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
2377 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2378 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2379 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2380 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2381 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2382 break;
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 }
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 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2387 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2388 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2389 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2390 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2391 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2392 if(strncmp(tmpbuf, "#32", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2393 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
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 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2396 case WM_CONTROL:
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2397 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2398 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
2399 _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
2400 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2401 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2402 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2403 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2404 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2405 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2406 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2407 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2408 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2409 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2410 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2411 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2412 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2413 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2414 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2415 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2416 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2417 _click_default(blah->clickdefault);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2418 /* 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
2419 * window hangs for reasons unknown. (in an MLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2420 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2421 else if(SHORT1FROMMP(mp2) == 283)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2422 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2423
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2424 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2425 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2426 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2427 /* 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
2428 if(strncmp(tmpbuf, "#38", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2429 WinPostMsg(hWnd, WM_USER+7, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2430 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2431 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2432 case WM_USER+7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2433 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2434 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
2435 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
2436 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2437 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2438 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2439 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2440 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2441 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2442 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2443
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2444 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2445 return oldproc(hWnd, msg, mp1, mp2);
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 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
2448 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2449
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2450 /* 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
2451 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
2452 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2453 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2454
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2455 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2456 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2457
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2458 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2459 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2460 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2461 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2462 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2463 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2464 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2465 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2466 return _entryproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2467 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2468 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2469 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2470 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2471 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2472 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2473 /* 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
2474 if(SHORT1FROMMP(mp2) == 283)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2475 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2476 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2477 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2478
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2479 if(blah && blah->oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2480 return blah->oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2481
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2482 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
2483 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2484
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2485 /* 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
2486 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
2487 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2488 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2489 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2490 case WM_VSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2491 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2492 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2493 USHORT pos = SHORT1FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2494
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2495 WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2496 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2497 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2498 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2499 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
2500 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2501
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2502 /* Handle special messages for the spinbutton's entryfield */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2503 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2504 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2505 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2506 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2507
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2508 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2509 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2510
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2511 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2512 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2513
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2514 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2515 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2516 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2517 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2518 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2519 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2520 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2521 case WM_COMMAND:
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
2522 return _entryproc(hWnd, msg, mp1, mp2);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2523 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2524
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2525 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2526 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2527
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2528 return WinDefWindowProc(hWnd, msg, mp1, mp2);
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2529 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2530
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2531 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
2532 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2533 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
2534 int range = _dw_percent_get_range(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2535 float fpos = (float)pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2536 float frange = (float)range;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2537 float fnew = (fpos/1000.0)*frange;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2538 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
2539 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2540
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2541 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
2542 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2543 int inew, range = _dw_percent_get_range(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2544 if(range)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2545 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2546 float fpos = (float)pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2547 float frange = (float)range;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2548 float fnew = (fpos/frange)*1000.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2549 inew = (int)fnew;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2550 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
2551 }
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2552 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2553
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2554 /* 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
2555 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
2556 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2557 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2558 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2559
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2560 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2561 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2562
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2563 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2564 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2565
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2566 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2567 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2568 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2569 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2570 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2571 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2572 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2573 WinPostMsg(hWnd, WM_USER+7, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2574 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2575 case WM_USER+7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2576 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
2577 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2578 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2579
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2580 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2581 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2582
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2583 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
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 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2587 * flag enabled, and also handle TABs to switch input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2588 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2589 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2590 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2591 WindowData *blah = WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2592 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2593
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2594 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2595 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2596
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2597 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2598 _TooltipProc(hWnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
2599
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2600 switch(msg)
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 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2603 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2604 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2605 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2606 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2607 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2608 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2609 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2610 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2611 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2612 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2613 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2614 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2615 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2616 _click_default(blah->clickdefault);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2617 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2618 case WM_BUTTON1DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2619 case WM_BUTTON2DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2620 case WM_BUTTON3DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2621 if(dw_window_get_data(hWnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2622 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2623 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2624 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2625 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2626 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2627 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2628 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2629 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2630 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2631 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2632 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2633 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2634 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2635 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2636 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
2637 HPS hpsPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2638 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2639 unsigned long width, height, thumbheight = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2640 ULONG color;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2641
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2642 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
2643 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
2644
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2645 if(!thumbheight)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2646 thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2647
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2648 /* 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
2649 thumbheight += 6;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2650
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2651 color = (ULONG)dw_window_get_data(parent, "_dw_fore");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2652 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
2653
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2654 if(height > thumbheight)
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 hpsPaint = WinGetPS(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2657 if(color)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2658 GpiSetColor(hpsPaint, _internal_color(color-1));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2659 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2660 GpiSetColor(hpsPaint, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2661
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2662 ptl.x = ptl.y = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2663 GpiMove(hpsPaint, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2664
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2665 ptl.x = width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2666 ptl.y = height - thumbheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2667 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2668
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2669 WinReleasePS(hpsPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2670 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2671 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2672 break;
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 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2675 return oldproc(hWnd, msg, mp1, mp2);
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 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2678 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2679
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2680 void _GetPPFont(HWND hwnd, char *buff)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2681 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2682 ULONG AttrFound;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2683 BYTE AttrValue[128];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2684 ULONG cbRetLen;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2685
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2686 cbRetLen = WinQueryPresParam(hwnd,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2687 PP_FONTNAMESIZE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2688 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2689 &AttrFound,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2690 sizeof(AttrValue),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2691 &AttrValue,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2692 QPF_NOINHERIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2693
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2694 if(PP_FONTNAMESIZE == AttrFound && cbRetLen)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2695 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2696 memcpy(buff, AttrValue, cbRetLen);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2697 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2698 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2699
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
2700 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
2701 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2702 MPARAM res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2703 int min, max, page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2704
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2705 if(which == SB_SLIDERTRACK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2706 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2707
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2708 pos = dw_scrollbar_get_pos(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2709 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0);
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 min = SHORT1FROMMP(res);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2712 max = SHORT2FROMMP(res);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2713 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
2714
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2715 switch(which)
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 case SB_LINEUP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2718 pos = pos - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2719 if(pos < min)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2720 pos = min;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2721 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2722 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2723 case SB_LINEDOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2724 pos = pos + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2725 if(pos > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2726 pos = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2727 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2728 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2729 case SB_PAGEUP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2730 pos = pos - page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2731 if(pos < min)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2732 pos = min;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2733 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2734 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2735 case SB_PAGEDOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2736 pos = pos + page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2737 if(pos > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2738 pos = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2739 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2740 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2741 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2742 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
2743 }
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
2744
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2745 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
2746 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2747 if(hwndEmph && WinIsWindow(dwhab, hwndEmph) && pCoreEmph)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2748 WinSendMsg(hwndEmph, CM_SETRECORDEMPHASIS, pCoreEmph, MPFROM2SHORT(FALSE, CRA_SOURCE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2749 hwndEmph = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2750 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
2751 }
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2752
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
2753 /* 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
2754 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
2755 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2756 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
2757 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
2758
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2759 /* Find the toplevel window */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2760 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
2761 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2762 menubar = (int)dw_window_get_data(lastowner, "_dw_menubar");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2763 lastowner = menuowner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2764 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2765 if(menuowner && menubar)
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 HWND client = WinWindowFromID(menuowner, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2768
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2769 return client ? client : menuowner;
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 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
2772 }
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
2773
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2774 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2775 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2776 int result = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2777 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2778 ULONG origmsg = msg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2779
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2780 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2781 msg = WM_BUTTON1DOWN;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2782 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2783 msg = WM_BUTTON1UP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2784 if(msg == WM_VSCROLL || msg == WM_HSCROLL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2785 msg = WM_CONTROL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2786
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2787 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2788 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2789 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2790 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
2791 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2792 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2793 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2794 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2795 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2796 if((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
2797 {
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
2798 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
2799
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2800 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
2801 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2802 result = setfocusfunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2803 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2804 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2805 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2806 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2807 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2808 case WM_TIMER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2809 {
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
2810 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
2811 if(tmp->id == (int)mp1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2812 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2813 if(!timerfunc(tmp->data))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2814 dw_timer_disconnect(tmp->id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2815 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2816 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2817 result = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2818 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2819 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2820 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2821 {
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
2822 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
2823
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2824 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
2825 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2826 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
2827 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2828 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2829 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2830 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2831 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2832 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2833 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
2834 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
2835
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2836 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
2837 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2838 int button = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2839
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2840 switch(origmsg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2841 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2842 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2843 button = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2844 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2845 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2846 button = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2847 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2848 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2849 button = 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2850 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2851 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2852
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
2853 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
2854 tmp = NULL;
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_BUTTON1UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2859 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2860 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
2861 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
2862
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2863 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
2864 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2865 int button = 0;
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 switch(origmsg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2868 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2869 case WM_BUTTON1UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2870 button = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2871 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2872 case WM_BUTTON2UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2873 button = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2874 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2875 case WM_BUTTON3UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2876 button = 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2877 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2880 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
2881 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2882 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2883 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2884 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2885 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2886 {
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
2887 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
2888
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2889 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
2890 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2891 int keys = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2892 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2893
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2894 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2895 keys = DW_BUTTON1_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2896 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2897 keys |= DW_BUTTON2_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2898 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2899 keys |= DW_BUTTON3_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2900
956
a3e4cebf3c99 Fixed incorrectly using _get_frame_height() instead of _get_height() which resulted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 906
diff changeset
2901 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
2902 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2905 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2906 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2907 {
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
2908 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
2909
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2910 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
2911 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2912 int vk;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2913 char ch = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2914
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2915 if(SHORT1FROMMP(mp1) & KC_CHAR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2916 ch = (char)SHORT1FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2917 if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2918 vk = SHORT2FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2919 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2920 vk = SHORT1FROMMP(mp2) + 128;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2921
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2922 /* This is a hack to fix shift presses showing
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2923 * up as tabs!
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2924 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2925 if(ch == '\t' && !(SHORT1FROMMP(mp1) & KC_CHAR))
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 ch = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2928 vk = VK_SHIFT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2929 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2930
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2931 result = keypressfunc(tmp->window, ch, vk,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2932 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
2933 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2934 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2935 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2936 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2937 case WM_CLOSE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2938 {
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
2939 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
2940
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2941 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
2942 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2943 result = closefunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2944 if(result)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2945 result = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2946 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2947 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2948 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2949 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2950 case WM_PAINT:
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 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2953 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
2954 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
2955 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2956
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2957 if(hWnd == tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2958 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2959 int height = _get_height(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2960
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2961 hps = WinBeginPaint(hWnd, 0L, &rc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2962 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
2963 exp.y = height - rc.yTop;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2964 exp.width = rc.xRight - rc. xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2965 exp.height = rc.yTop - rc.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2966 result = exposefunc(hWnd, &exp, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2967 WinEndPaint(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2968 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2969 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2970 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2971 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2972 {
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
2973 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
2974 ULONG command = COMMANDMSG(&msg)->cmd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2975
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2976 if(tmp->id && command == tmp->id)
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 HWND menuowner = _menu_owner(tmp->window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2979
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2980 if(menuowner == hWnd || menuowner == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2981 {
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
2982 result = clickfunc((HWND)tmp->id, tmp->data);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2983 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2984 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2985 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2986 else if(tmp->window < 65536 && command == tmp->window)
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 result = clickfunc(popup ? popup : tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2989 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2990 }
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 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2993 case WM_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2994 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
2995 (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
2996 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2997 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
2998 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
2999 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
3000
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3001 if(origmsg == WM_CONTROL)
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3002 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3003 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
3004 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
3005 notifyhwnd = (HWND)mp2;
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3006 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3007
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3008 switch(svar)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3009 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3010 case CN_ENTER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3011 {
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
3012 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
3013 char *text = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3014
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3015 if(mp2)
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 PRECORDCORE pre;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3018
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3019 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3020 if(pre)
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
3021 text = (char *)pre->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3022 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3023
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
3024 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3025 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3026 result = containerselectfunc(tmp->window, text, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3027 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3028 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3029 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3030 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3031 case CN_EXPANDTREE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3032 {
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
3033 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
3034
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
3035 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3036 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3037 result = treeexpandfunc(tmp->window, (HTREEITEM)mp2, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3038 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3039 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3040 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3041 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3042 case CN_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3043 {
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
3044 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
3045 char *text = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3046 void *user = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3047 LONG x,y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3048
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3049 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3050 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3051 PCNRITEM pci;
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 pci = (PCNRITEM)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3054
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
3055 text = (char *)pci->rc.pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3056 user = pci->user;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3059 dw_pointer_query_pos(&x, &y);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3060
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
3061 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3062 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3063 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
3064
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3065 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3066 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3067 if(!container)
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 NOTIFYRECORDEMPHASIS pre;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3070
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3071 dw_tree_item_select(tmp->window, (HTREEITEM)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3072 pre.pRecord = mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3073 pre.fEmphasisMask = CRA_CURSORED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3074 pre.hwndCnr = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3075 _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
3076 pre.pRecord->flRecordAttr |= CRA_CURSORED;
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3079 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3080 if(pCoreEmph)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3081 _clear_emphasis();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3082 hwndEmph = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3083 pCoreEmph = mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3084 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
3085 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3086 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3087 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
3088 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3089 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3090 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3091 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3092 case CN_EMPHASIS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3093 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3094 PNOTIFYRECORDEMPHASIS pre = (PNOTIFYRECORDEMPHASIS)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3095 static int emph_recurse = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3096
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3097 if(!emph_recurse)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3098 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3099 emph_recurse = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3100
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3101 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3102 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3103 if(tmp->window == pre->hwndCnr)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3104 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3105 PCNRITEM pci = (PCNRITEM)pre->pRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3106
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3107 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
3108 {
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
3109 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
3110
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3111 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
3112 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
3113 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3114 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3115 if(lasthcnr == tmp->window && lastitem == (HWND)pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3116 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3117 lasthcnr = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3118 lastitem = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3119 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3120 else
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 lasthcnr = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3123 lastitem = (HWND)pci;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
3124 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
3125 }
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 tmp = NULL;
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 }
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 emph_recurse = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3132 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3133 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3134 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3135 case LN_SELECT:
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 char classbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3138
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
3139 WinQueryClassName(tmp->window, 99, (PCH)classbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3140
1743
a297b2bde127 Added some comments that aided in remembering how the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1739
diff changeset
3141 /* Slider/Percent */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3142 if(strncmp(classbuf, "#38", 4) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3143 {
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
3144 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
3145
1197
cad6f7aa421c Fixed a couple slight issues with the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1196
diff changeset
3146 if(tmp->window == hWnd || tmp->window == notifyhwnd)
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 static int lastvalue = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3149 static HWND lasthwnd = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3150 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
3151 if(lastvalue != ulValue || lasthwnd != tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3152 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3153 result = valuechangedfunc(tmp->window, ulValue, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3154 lastvalue = ulValue;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3155 lasthwnd = tmp->window;
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 tmp = NULL;
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3160 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3161 {
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
3162 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
3163 static int _recursing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3164
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
3165 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
3166 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3167 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
3168 int index = dw_listbox_selected(tmp->window);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3169
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3170 dw_listbox_get_text(tmp->window, index, buf1, 500);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3171
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3172 _recursing = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3173
1743
a297b2bde127 Added some comments that aided in remembering how the combobox
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1739
diff changeset
3174 /* Combobox */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3175 if(id && strncmp(classbuf, "#2", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3176 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3177 char *buf2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3178
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3179 buf2 = dw_window_get_text(tmp->window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3180
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3181 /* 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
3182 * 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
3183 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3184 if(buf2 && *buf2 && *buf1 && strncmp(buf1, buf2, 500) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3185 result = listboxselectfunc(tmp->window, index, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3186
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3187 if(buf2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3188 free(buf2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3189 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3190 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3191 result = listboxselectfunc(tmp->window, index, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3192
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3193 _recursing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3194 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3195 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3196 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3197 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3198 break;
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3199 case SPBN_CHANGE:
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3200 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3201 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
3202
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3203 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
3204 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3205 /* Handle Spinbutton control */
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3206 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
3207 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3208 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
3209 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
3210 tmp = NULL;
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3211 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3212 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3213 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3214 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3215 case SLN_SLIDERTRACK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3216 {
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
3217 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
3218
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3219 if(origmsg == WM_CONTROL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3220 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3221 /* 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
3222 if(tmp->window == hWnd || tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3223 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3224 static int lastvalue = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3225 static HWND lasthwnd = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3226 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
3227 if(lastvalue != ulValue || lasthwnd != tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3228 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3229 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
3230 result = valuechangedfunc(tmp->window, ulValue, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3231 lastvalue = ulValue;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3232 lasthwnd = tmp->window;
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 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3235 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3236 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3237 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3238 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3239 /* 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
3240 if(tmp->window > 65535 && tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3241 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3242 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
3243
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3244 if(pos > -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3245 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3246 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
3247 result = valuechangedfunc(tmp->window, pos, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3248 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3249 result = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3250 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3251 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3252 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3253 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3254 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3255 case BKN_PAGESELECTED:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3256 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3257 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3258
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3259 if(psn && tmp->window == psn->hwndBook)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3260 {
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
3261 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
3262
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3263 result = switchpagefunc(tmp->window, psn->ulPageIdNew, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3264 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3265 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3266 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3267 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3268 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3269 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3270 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3271 }
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3274 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3275 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3276
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3277 }
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
3278 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
3279 {
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
3280 /* 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
3281 _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
3282 /* 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
3283 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3284 return (MRESULT)result;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3285 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3286
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
3287 /* 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
3288 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
3289 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3290 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
3291 long red, green, blue;
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 red = dw_spinbutton_get_pos(button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3294 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
3295 green = dw_spinbutton_get_pos(button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3296 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
3297 blue = dw_spinbutton_get_pos(button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3298
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3299 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
3300 }
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
3301
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
3302 /* 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
3303 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
3304 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3305 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
3306 dw_window_set_data(window, "_dw_updating", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3307 dw_spinbutton_set_pos(button, DW_RED_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3308 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
3309 dw_spinbutton_set_pos(button, DW_GREEN_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3310 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
3311 dw_spinbutton_set_pos(button, DW_BLUE_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3312 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
3313 }
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
3314
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
3315 /* 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
3316 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
3317 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3318 WinSendMsg(col, 0x0602, MPFROMLONG(_os2_color(value)), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3319 if(!IS_WARP4())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3320 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
3321 }
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
3322
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3323 /* Handles control messages sent to the box (owner). */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3324 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3325 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3326 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3327
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3328 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3329 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3330 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3331 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3332 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3333 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3334 case WM_VSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3335 case WM_HSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3336 if(_run_event(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3337 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3338 HWND window = WinWindowFromID(hWnd, (ULONG)mp1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3339 _HandleScroller(window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3340 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3341 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3342 /* Handles Color Selection control messages */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3343 case 0x0601:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3344 case 0x130C:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3345 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3346 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
3347 unsigned long val = (unsigned long)mp1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3348
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3349 if(window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3350 _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
3351 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3352 break;
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3353 case WM_USER:
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3354 _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
3355 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3356 case WM_CONTROL:
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3357 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3358 char tmpbuf[100];
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3359
1636
1d3013463204 Fixed a couple warnings generated by the new OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1625
diff changeset
3360 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
3361 /* 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
3362 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
3363 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3364 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
3365 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3366 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
3367
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3368 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
3369 {
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3370 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
3371 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
3372
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3373 _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
3374 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3375 }
1636
1d3013463204 Fixed a couple warnings generated by the new OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1625
diff changeset
3376 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
3377 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
3378 }
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3379 else
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
3380 _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
3381 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3382 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3383 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3384
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3385 if(blah && blah->oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3386 return blah->oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3387
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3388 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3389 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3390
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3391 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3392 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3393 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3394 int result = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3395 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
3396 void (API_FUNC windowfunc)(PVOID) = 0L;
643
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 if(!command_active)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3399 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3400 /* 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
3401 command_active = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3402
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
3403 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
3404 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
3405 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
3406 result = (int)_run_event(hWnd, msg, mp1, mp2);
643
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 command_active = 0;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3411 /* Now that any handlers are done... do normal processing */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3412 switch( msg )
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3413 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3414 case WM_ERASEBACKGROUND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3415 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3416
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3417 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3418 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3419 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3420 RECTL rc;
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 hps = WinBeginPaint( hWnd, 0L, &rc );
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3423 WinEndPaint( hps );
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3424 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3425 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3426
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3427 case WM_SIZE:
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 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3430
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3431 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3432 return (MPARAM)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3433
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3434 if(mybox && mybox->flags != DW_MINIMIZED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3435 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3436 /* Hide the window when recalculating to reduce
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3437 * CPU load.
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 WinShowWindow(hWnd, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3440
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
3441 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
3442 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
3443
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3444 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3445
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3446 WinShowWindow(hWnd, TRUE);
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3449 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3450 case WM_MINMAXFRAME:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3451 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3452 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3453 SWP *swp = (SWP *)mp1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3454
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3455 if(mybox && (swp->fl & SWP_MINIMIZE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3456 mybox->flags = DW_MINIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3457
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3458 if(mybox && (swp->fl & SWP_RESTORE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3459 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3460 if(!mybox->titlebar && mybox->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3461 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3462 mybox->flags = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3463 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3464
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3465 if(mybox && (swp->fl & (SWP_MAXIMIZE | SWP_RESTORE)))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3466 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3467 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3468 SWP swp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3469
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3470 WinQueryWindowPos(swp->hwnd, &swp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3471
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3472 if(swp2.cx == swp->cx && swp2.cy == swp->cy)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3473 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3474
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3475 mybox->flags = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3476
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3477 /* Hide the window when recalculating to reduce
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3478 * CPU load.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3479 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3480 WinShowWindow(hWnd, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3481
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3482 _do_resize(mybox, swp->cx, swp->cy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3483
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3484 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3485 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3486 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3487
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3488 for(z=0;z<mybox->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3489 _check_resize_notebook(mybox->items[z].hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3490
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3491 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3492
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3493 WinShowWindow(hWnd, TRUE);
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3496 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3497 case WM_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3498 switch(SHORT2FROMMP(mp1))
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 case BKN_PAGESELECTEDPENDING:
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 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3503 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
3504 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
3505 long x, y;
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
3506 unsigned long width, height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3507 RECTL rc;
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(pagebox && psn->ulPageIdNew != psn->ulPageIdCur)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3510 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3511 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
3512
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3513 rc.xLeft = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3514 rc.yBottom = y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3515 rc.xRight = x + width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3516 rc.yTop = y + height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3517
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3518 WinSendMsg(psn->hwndBook, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3519
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3520 _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
3521 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3522 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3523 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3524 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3525 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3526 case WM_CLOSE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3527 if(result == -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3528 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3529 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3530 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3531 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3532 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3533 case WM_MOUSEMOVE:
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 HPOINTER pointer;
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 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
3538 (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
3539 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3540 WinSetPointer(HWND_DESKTOP, pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3541 return MRFROMSHORT(TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3542 }
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 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3545 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
3546 windowfunc = (void (API_FUNC)(void *))mp1;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3547
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3548 if(windowfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3549 windowfunc((void *)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3550 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3551 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3552 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3553 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3554 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3555 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3556 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3557 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3558 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3559 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3560 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3561 case WM_DESTROY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3562 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3563 HWND parent = WinQueryWindow(hWnd, QW_PARENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3564
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3565 /* Free memory before destroying */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3566 if(parent && WinWindowFromID(parent, FID_CLIENT) == hWnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3567 _free_window_memory(parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3568 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3569 _free_window_memory(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3570 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3571 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3572 case WM_MENUEND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3573 /* Delay removing the signal until we've executed
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3574 * the signal handler.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3575 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3576 WinPostMsg(hWnd, WM_USER+2, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3577 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
3578 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
3579 /* 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
3580 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
3581 break;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3582 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
3583 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
3584 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
3585 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
3586 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
3587 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
3588 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
3589 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
3590 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3591 case WM_USER+2:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3592 _clear_emphasis();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3593 if(dw_window_get_data((HWND)mp2, "_dw_popup"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3594 _free_menu_data((HWND)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3595 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3596 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3597
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3598 if(result != -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3599 return (MRESULT)result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3600 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3601 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3602 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3603
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3604 void _changebox(Box *thisbox, int percent, int type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3605 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3606 int z;
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 for(z=0;z<thisbox->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3609 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3610 if(thisbox->items[z].type == TYPEBOX)
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 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3613 _changebox(tmp, percent, type);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3614 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3615 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3616 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3617 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3618 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3619 if(thisbox->items[z].hsize == SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3620 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
3621 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3622 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3623 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3624 if(thisbox->items[z].vsize == SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3625 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
3626 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3627 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3628 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3629 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3630
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3631 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
3632 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3633 float ratio = (float)percent/(float)100.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3634 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
3635 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
3636 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3637
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3638 WinShowWindow(handle1, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3639 WinShowWindow(handle2, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3640
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3641 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3642 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3643 int newx = (int)((float)x * ratio) - (SPLITBAR_WIDTH/2);
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 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
3646 _do_resize(tmp, newx - 1, y - 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3647
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3648 dw_window_set_data(hwnd, "_dw_start", (void *)newx);
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 tmp = WinQueryWindowPtr(handle2, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3651
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3652 newx = x - newx - SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3653
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3654 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
3655 _do_resize(tmp, newx - 1, y - 1);
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3658 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3659 int newy = (int)((float)y * ratio) - (SPLITBAR_WIDTH/2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3660
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3661 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
3662 _do_resize(tmp, x - 1, newy - 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3663
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3664 tmp = WinQueryWindowPtr(handle2, QWP_USER);
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 newy = y - newy - SPLITBAR_WIDTH;
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 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
3669 _do_resize(tmp, x - 1, newy - 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3670
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3671 dw_window_set_data(hwnd, "_dw_start", (void *)newy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3672 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3673
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3674 WinShowWindow(handle1, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3675 WinShowWindow(handle2, TRUE);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3676 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3677
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3678
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3679 /* This handles any activity on the splitbars (sizers) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3680 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3681 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3682 switch (msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3683 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3684 case WM_ACTIVATE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3685 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3686 return (MRESULT)(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3687
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3688 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3689 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3690 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3691 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3692 RECTL rcl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3693 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
3694 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
3695
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3696 hps = WinBeginPaint(hwnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3697
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3698 WinQueryWindowRect(hwnd, &rcl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3699
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3700 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3701 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3702 ptl[0].x = rcl.xLeft + start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3703 ptl[0].y = rcl.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3704 ptl[1].x = rcl.xRight + start + 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3705 ptl[1].y = rcl.yTop;
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 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3708 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3709 ptl[0].x = rcl.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3710 ptl[0].y = rcl.yBottom + start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3711 ptl[1].x = rcl.xRight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3712 ptl[1].y = rcl.yTop + start + 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3713 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3714
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3715
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3716 GpiSetColor(hps, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3717 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3718 GpiBox(hps, DRO_OUTLINEFILL, &ptl[1], 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3719 WinEndPaint(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3720 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3721 return MRFROMSHORT(FALSE);
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 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3724 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3725 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
3726
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3727 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3728 WinSetPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3729 WinQuerySysPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3730 SPTR_SIZEWE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3731 FALSE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3732 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3733 WinSetPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3734 WinQuerySysPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3735 SPTR_SIZENS,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3736 FALSE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3737 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3738 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3739 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3740 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3741 APIRET rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3742 RECTL rclFrame;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3743 RECTL rclBounds;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3744 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
3745 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
3746 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
3747
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3748 WinQueryWindowRect(hwnd, &rclFrame);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3749 WinQueryWindowRect(hwnd, &rclBounds);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3750
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3751 WinMapWindowPoints(hwnd, HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3752 (PPOINTL)&rclBounds, 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3753
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3754
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3755 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3756 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3757 rclFrame.xLeft = start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3758 rclFrame.xRight = start + SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3759 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3760 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3761 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3762 rclFrame.yBottom = start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3763 rclFrame.yTop = start + SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3764 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3765
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3766 if(percent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3767 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3768 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3769
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3770 if(rc == TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3771 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3772 int width = (rclBounds.xRight - rclBounds.xLeft);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3773 int height = (rclBounds.yTop - rclBounds.yBottom);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3774
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3775 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3776 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3777 start = rclFrame.xLeft - rclBounds.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3778 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3779 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3780 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3781 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3782 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3783 start = rclFrame.yBottom - rclBounds.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3784 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3785 *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
3786 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3787 _handle_splitbar_resize(hwnd, *percent, type, width, height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3788 _handle_splitbar_resize(hwnd, *percent, type, width, height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3789 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3790 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3791 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3792 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3793 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3794 return WinDefWindowProc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3795 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3796
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
3797 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
3798 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3799 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
3800 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
3801 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
3802 MRESULT res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3803 unsigned long width, height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3804 int x = 5, y = 5;
1661
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3805 ULONG style = WinQueryWindowULong(hwnd, QWL_STYLE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3806
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3807 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
3808
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3809 if(!oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3810 res = WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3811 res = oldproc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3812
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3813 if(icon)
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 ULONG halftone = DP_NORMAL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3816 HPS hps = WinGetPS(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3817 POINTERINFO pi;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3818 int cx, cy;
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 if(dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3821 halftone = DP_HALFTONED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3822
1661
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3823 /* If there is a border take that into account */
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3824 if(style & BS_NOBORDER)
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3825 {
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3826 cx = width;
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3827 cy = height;
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3828 }
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3829 else
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3830 {
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3831 cx = width - 8;
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3832 cy = height - 8;
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
3833 }
643
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 if(WinQueryPointerInfo(icon, &pi))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3836 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3837 BITMAPINFOHEADER sl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3838 int newcx = cx, newcy = cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3839
1736
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
3840 sl.cbFix = sizeof(BITMAPINFOHEADER);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
3841
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3842 /* Check the mini icon first */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3843 if(GpiQueryBitmapParameters(pi.hbmMiniColor, &sl))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3844 {
1739
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3845 if(sl.cx && sl.cy && cx > sl.cx && cy > sl.cy)
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3846 {
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3847 newcx = sl.cx;
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3848 newcy = sl.cy;
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3849 }
643
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 /* Check the normal icon second */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3852 if(GpiQueryBitmapParameters(pi.hbmColor, &sl))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3853 {
1739
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3854 if(sl.cx && sl.cy)
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3855 {
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3856 if(cx > sl.cx && cy > sl.cy)
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3857 {
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3858 newcx = sl.cx;
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3859 newcy = sl.cy;
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3860 }
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3861 /* In case there was no mini icon... cut it in half */
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3862 else if(cx >= (sl.cx/2) && cy >= (sl.cy/2))
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3863 {
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3864 newcx = sl.cx/2;
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3865 newcy = sl.cy/2;
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3866 }
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3867 }
643
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 cx = newcx; cy = newcy;
1739
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3870 /* Safety check to avoid icon dimension stretching */
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3871 if(cx != cy)
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3872 {
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3873 if(cx > cy)
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3874 cx = cy;
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3875 else
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3876 cy = cx;
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3877 }
c68ee60fb8b0 Improved method of figuring out the best icon size on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1737
diff changeset
3878 /* Finally center it in the window */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3879 x = (width - cx)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3880 y = (height - cy)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3881 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3882 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
3883 WinReleasePS(hps);
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 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3886 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3887 x = (width - pixmap->width)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3888 y = (height - pixmap->height)/2;
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 if(disable && dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3891 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
3892 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3893 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
3894 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3895 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
3896 }
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3897
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3898 /* Function: BtProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3899 * Abstract: Subclass procedure for buttons
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3900 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3901
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3902 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3903 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3904 WindowData *blah = WinQueryWindowPtr(hwnd, QWL_USER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3905 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
3906 int retval = -1;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3907
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3908 if(!blah)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3909 return WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3910
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3911 oldproc = blah->oldproc;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3912
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3913 if(blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3914 _TooltipProc(hwnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
3915
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3916 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3917 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3918 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3919 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3920 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3921 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3922 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3923 return _button_draw(hwnd, msg, mp1, mp2, oldproc, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3924 case BM_SETHILITE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3925 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
3926 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3927 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3928 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3929 else
1337
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3930 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
3931 /* 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
3932 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
3933 {
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3934 RECTL rcl;
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3935
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3936 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
3937
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3938 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
3939 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
3940 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3941 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3942 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3943 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3944 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3945 case WM_BUTTON1DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3946 case WM_BUTTON2DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3947 case WM_BUTTON3DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3948 if(dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3949 return (MRESULT)FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3950 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3951 case WM_BUTTON1UP:
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 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3954
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3955 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
3956 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3957 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3958 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3959 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3960 if(tmp->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3961 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3962 /* 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
3963 if(tmp->window == hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3964 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3965 /* 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
3966 * here, finishing actions on the button will occur
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3967 * 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
3968 * 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
3969 * do before we run our handler.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3970 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3971 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3972 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3973 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3974 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3975 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3976 tmp= tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3977 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3978 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3979 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3980 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3981 case WM_USER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3982 {
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
3983 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
3984 int (API_FUNC clickfunc)(HWND, void *) = NULL;
643
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(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3987 {
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
3988 clickfunc = (int (API_FUNC)(HWND, void *))tmp->signalfunction;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3989
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
3990 retval = clickfunc(tmp->window, tmp->data);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3991 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3992 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3993 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3994 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3995 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3996 /* 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
3997 * while the button has the active input focus.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3998 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3999 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4000 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4001 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4002
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4003 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4004 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4005 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4006 if(tmp->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4007 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4008 /* 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
4009 if(tmp->window == hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4010 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4011 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4012 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4013 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4014 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4015 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4016 tmp= tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4017 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4018 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4019 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4020 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4021 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4022 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4023 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4024 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4025 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4026 return FALSE;
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 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
4029 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4030 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4031 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4032 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4033 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
4034 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4035 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4036 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4037 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4038 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4039 break;
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
4040 }
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
4041
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
4042 /* 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
4043 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
4044 _dw_redraw(0, FALSE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4045 if(!oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4046 return WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4047 return oldproc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4048 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4049
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4050 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4051 {
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
4052 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
4053 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
4054
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
4055 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
4056 _TooltipProc(hwnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
4057
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4058 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4059 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4060 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4061 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4062 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4063 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4064 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4065 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4066 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4067 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
4068 WinSetFocus(HWND_DESKTOP, hwnd);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4069 else if(res)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4070 return (MPARAM)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4071 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4072 return WinDefWindowProc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4073 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4074
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4075 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
4076 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4077 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4078 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4079
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4080 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4081 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4082
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
4083 if(blah && blah->bubbletext[0])
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
4084 _TooltipProc(hwnd, msg, mp1, mp2, blah);
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
4085
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4086 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4087 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4088 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4089 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4090 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4091 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4092 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4093 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4094 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4095 RECTL rcl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4096 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4097
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4098 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4099 oldproc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4100
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4101 hps = WinBeginPaint(hwnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4102 WinQueryWindowRect(hwnd, &rcl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4103 ptl[0].x = rcl.xLeft + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4104 ptl[0].y = rcl.yBottom + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4105 ptl[1].x = rcl.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4106 ptl[1].y = rcl.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4107
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4108 GpiSetColor(hps, CLR_BLACK);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4109 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4110 GpiBox(hps, DRO_OUTLINE, &ptl[1], 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4111 WinEndPaint(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4112 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4113 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4114 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4115 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4116 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4117 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4118 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4119 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4120 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4121 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4122 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4123 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4124 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4125 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4126 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4129 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4130
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4131 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4132 return oldproc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4133
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4134 return WinDefWindowProc(hwnd, msg, mp1, mp2);
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4135 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
4136
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4137 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4138 * Initializes the Dynamic Windows engine.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4139 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4140 * newthread: True if this is the only thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4141 * False if there is already a message loop running.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4142 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4143 int API dw_init(int newthread, int argc, char *argv[])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4144 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4145 APIRET rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4146 char objnamebuf[300] = "";
1591
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4147 int x;
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4148 struct tm thistm = { 0 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4149
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4150 /* 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
4151 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
4152 {
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4153 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
4154
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4155 /* 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
4156 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
4157 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
4158
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4159 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
4160 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
4161 }
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4162 /* 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
4163 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
4164 _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
4165
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4166 if(newthread)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4167 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4168 dwhab = WinInitialize(0);
1690
0f4bbb78f149 Ugg this stupid editor keeps adding tabs!
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1689
diff changeset
4169 dwhmq = WinCreateMsgQueue(dwhab, 0);
1689
3fb7002e4de6 Unicode (UTF-8) mode on OS/2 as noted to me by Alex Taylor comes with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1688
diff changeset
4170 #ifdef UNICODE
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
4171 /* Set the codepage to 1208 (UTF-8) */
1690
0f4bbb78f149 Ugg this stupid editor keeps adding tabs!
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1689
diff changeset
4172 WinSetCp(dwhmq, 1208);
1689
3fb7002e4de6 Unicode (UTF-8) mode on OS/2 as noted to me by Alex Taylor comes with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1688
diff changeset
4173 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4174 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4175
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4176 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
4177 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
4178 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
4179 rc = WinRegisterClass(dwhab, (PSZ)CalendarClassName, _calendarproc, 0L, 32);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4180
1591
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4181 /* 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
4182 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
4183 {
1592
1795bd78207d Tab fixed for that last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1591
diff changeset
4184 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
4185 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
4186 }
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4187 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
4188 {
1592
1795bd78207d Tab fixed for that last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1591
diff changeset
4189 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
4190 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
4191 }
c5e210e04dce Attempt at localizing the calendar widget on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1570
diff changeset
4192
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4193 /* Get the OS/2 version. */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4194 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
4195
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4196 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4197
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4198 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
4199 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
4200 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
4201 DefaultFont = strdup(DefaultFont);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4202
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4203 /* 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
4204 * application does and handles menu messages.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4205 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4206 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
4207 /* 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
4208 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
4209
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4210 /* 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
4211 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
4212 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
4213 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
4214 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
4215 DosQueryProcAddr(pmmerge, 5469, NULL, (PFN*)&_WinQueryDesktopWorkArea);
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4216 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"GBM", &gbm))
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4217 {
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4218 /* Load the _System versions of the functions from the library */
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
4219 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_err", (PFN*)&_gbm_err);
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4220 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_init", (PFN*)&_gbm_init);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4221 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_deinit", (PFN*)&_gbm_deinit);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4222 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_io_open", (PFN*)&_gbm_io_open);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4223 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_io_close", (PFN*)&_gbm_io_close);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4224 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_read_data", (PFN*)&_gbm_read_data);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4225 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_read_header", (PFN*)&_gbm_read_header);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4226 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_read_palette", (PFN*)&_gbm_read_palette);
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
4227 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_query_n_filetypes", (PFN*)&_gbm_query_n_filetypes);
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4228 /* If we got the functions, try to initialize the library */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4229 if(!_gbm_init || _gbm_init())
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4230 {
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4231 /* Otherwise clear out the function pointers */
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
4232 _gbm_init=0;_gbm_deinit=0;_gbm_io_open=0;_gbm_io_close=0;_gbm_query_n_filetypes=0;
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
4233 _gbm_read_header=0;_gbm_read_palette=0;_gbm_read_data=0;_gbm_err=0;
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4234 }
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
4235 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4236 return rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4237 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4238
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4239 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
4240
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4241 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4242 * 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
4243 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4244 void API dw_main(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4245 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4246 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4247
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4248 _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
4249 /* 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
4250 _dw_redraw(0, FALSE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4251
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4252 /* 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
4253 _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
4254
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4255 /* 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
4256 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
4257 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4258 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4259 _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
4260 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4261 }
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4262 }
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4263
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4264 /*
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4265 * 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
4266 */
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4267 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
4268 {
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
4269 _dw_main_running = FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4270 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4271
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4272 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4273 * 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
4274 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4275 * 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
4276 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4277 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
4278 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4279 QMSG qmsg;
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4280 #ifdef __EMX__
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4281 struct timeval tv, start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4282
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4283 gettimeofday(&start, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4284 gettimeofday(&tv, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4285
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4286 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
4287 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4288 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4289 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4290 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4291 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4292 _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
4293 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4294 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4295 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4296 DosSleep(1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4297 gettimeofday(&tv, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4298 }
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
4299 #else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4300 double start = (double)clock();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4301
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4302 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4303 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4304 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4305 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4306 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4307 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4308 _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
4309 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4310 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4311 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4312 DosSleep(1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4313 }
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4314 #endif
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4315 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4316
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4317 /*
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
4318 * 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
4319 */
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
4320 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
4321 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4322 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4323
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4324 _dwtid = dw_thread_id();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4325
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4326 if(WinGetMsg(dwhab, &qmsg, 0, 0, 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4327 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4328 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4329 _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
4330 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4331 }
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
4332 }
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
4333
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
4334 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4335 * Free's memory allocated by dynamic windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4336 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4337 * ptr: Pointer to dynamic windows allocated
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4338 * memory to be free()'d.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4339 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4340 void API dw_free(void *ptr)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4341 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4342 free(ptr);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4343 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4344
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4345 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4346 * Allocates and initializes a dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4347 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4348 * data: User defined data to be passed to functions.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4349 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4350 DWDialog * API dw_dialog_new(void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4351 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4352 DWDialog *tmp = malloc(sizeof(DWDialog));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4353
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4354 tmp->eve = dw_event_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4355 dw_event_reset(tmp->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4356 tmp->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4357 tmp->done = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4358 tmp->result = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4359
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4360 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4361 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4362
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4363 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4364 * Accepts a dialog struct and returns the given data to the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4365 * initial called of dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4366 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4367 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4368 * result: Data to be returned by dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4369 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4370 int API dw_dialog_dismiss(DWDialog *dialog, void *result)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4371 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4372 dialog->result = result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4373 dw_event_post(dialog->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4374 dialog->done = TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4375 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4376 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4377
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4378 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4379 * Accepts a dialog struct waits for dw_dialog_dismiss() to be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4380 * called by a signal handler with the given dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4381 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4382 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4383 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4384 void * API dw_dialog_wait(DWDialog *dialog)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4385 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4386 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4387 void *tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4388
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4389 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4390 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4391 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4392 _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
4393 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4394 if(dialog->done)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4395 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4396 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4397 dw_event_close(&dialog->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4398 tmp = dialog->result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4399 free(dialog);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4400 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4401 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4402
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
4403 /*
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
4404 * 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
4405 * 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
4406 * 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
4407 * ...: 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
4408 */
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
4409 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
4410 {
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
4411 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
4412 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
4413
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
4414 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
4415 #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
4416 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
4417 #else
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4418 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
4419 #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
4420 va_end(args);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4421
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4422 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
4423 {
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
4424 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
4425
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
4426 /* 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
4427 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
4428 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
4429 _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
4430 }
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4431 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
4432 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
4433 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4434
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4435 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4436 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4437 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4438 * 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
4439 * flags: flags to indicate buttons and icon
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4440 * format: printf style format string.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4441 * ...: Additional variables for use in the format.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4442 */
399
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
4443 int API dw_messagebox(char *title, int flags, char *format, ...)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4444 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4445 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
4446 char outbuf[1025] = { 0 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4447 int rc;
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 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
4450 #if defined(__IBMC__)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4451 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
4452 #else
56f311dc23f6 Changes to get the library building with Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1400
diff changeset
4453 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
4454 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4455 va_end(args);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4456
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4457 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
4458 if(rc == MBID_OK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4459 return DW_MB_RETURN_OK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4460 else if(rc == MBID_YES)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4461 return DW_MB_RETURN_YES;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4462 else if(rc == MBID_NO)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4463 return DW_MB_RETURN_NO;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4464 else if(rc == MBID_CANCEL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4465 return DW_MB_RETURN_CANCEL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4466 else return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4467 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4468
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4469 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4470 * Makes the window topmost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4471 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4472 * 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
4473 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4474 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
4475 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4476 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
4477 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4478
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4479 /*
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4480 * Makes the window bottommost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4481 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4482 * 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
4483 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4484 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
4485 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4486 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
4487 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4488
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4489 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4490 * Makes the window visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4491 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4492 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4493 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4494 int API dw_window_show(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4495 {
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
4496 int rc = WinShowWindow(handle, TRUE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4497 HSWITCH hswitch;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4498 SWCNTRL swcntrl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4499
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4500 _fix_button_owner(_toplevel_window(handle), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4501 WinSetFocus(HWND_DESKTOP, handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4502 _initial_focus(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4503
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4504 /* 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
4505 hswitch = WinQuerySwitchHandle(handle, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4506 if(hswitch)
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 WinQuerySwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4509 swcntrl.uchVisibility = SWL_VISIBLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4510 WinChangeSwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4511 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4512 if(WinWindowFromID(handle, FID_CLIENT))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4513 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4514 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4515
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4516 if(blah && !(blah->flags & DW_OS2_NEW_WINDOW))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4517 {
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4518 /* Handle auto-positioning and auto-sizing */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4519 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
4520 HWND parent = WinQueryWindow(handle, QW_PARENT);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4521 int newx, newy, changed = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4522 SWP swp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4523
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4524 /* 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
4525 * 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
4526 */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4527 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
4528 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4529 WinQueryWindowPos(parent, &swp);
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4530 cx = swp.cx;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4531 cy = swp.cy;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4532 /* 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
4533 * 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
4534 */
1495
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
4535 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
4536 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4537 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
4538 return rc;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4539 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4540 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4541
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4542 blah->flags |= DW_OS2_NEW_WINDOW;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4543
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4544 WinQueryWindowPos(handle, &swp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4545
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4546 /* 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
4547 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
4548 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4549 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
4550 WinQueryWindowPos(handle, &swp);
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4551 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4552
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4553 /* 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
4554 * 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
4555 */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4556 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
4557 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4558 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
4559 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
4560
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4561 defaultx += 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4562 defaulty += 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4563
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4564 if(defaultx > maxx)
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4565 defaultx = 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4566 if(defaulty > maxy)
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4567 defaulty = 20;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4568
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4569 newx = defaultx;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4570 /* 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
4571 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
4572 changed = 1;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4573 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4574 else
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4575 {
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4576 newx = swp.x;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4577 newy = swp.y;
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4578 }
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4579
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4580 /* 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
4581 * 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
4582 */
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4583 if(swp.cx < cx && (newx+swp.cx) > cx)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4584 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4585 newx = (cx - swp.cx)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4586 changed = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4587 }
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4588 if(swp.cy < cy && (newy+swp.cy) > cy)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4589 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4590 newy = (cy - swp.cy)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4591 changed = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4592 }
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
4593
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4594 if(changed)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4595 WinSetWindowPos(handle, NULLHANDLE, newx, newy, 0, 0, SWP_MOVE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4596 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4597 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4598 return rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4599 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4600
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4601 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4602 * 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
4603 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4604 * handle: The window handle to minimize.
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4605 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4606 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
4607 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4608 HWND hwndclient = WinWindowFromID(handle, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4609
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4610 if(hwndclient)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4611 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4612 Box *box = (Box *)WinQueryWindowPtr(hwndclient, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4613
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4614 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4615 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4616 if(!box->titlebar && box->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4617 WinSetParent(box->hwndtitle, handle, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4618 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4619 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4620
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4621 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
4622 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4623
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4624 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4625 * Makes the window invisible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4626 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4627 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4628 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4629 int API dw_window_hide(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4630 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4631 HSWITCH hswitch;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4632 SWCNTRL swcntrl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4633
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4634 /* 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
4635 hswitch = WinQuerySwitchHandle(handle, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4636 if(hswitch)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4637 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4638 WinQuerySwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4639 swcntrl.uchVisibility = SWL_INVISIBLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4640 WinChangeSwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4641 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4642 return WinShowWindow(handle, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4643 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4644
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4645 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4646 * Destroys a window and all of it's children.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4647 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4648 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4649 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4650 int API dw_window_destroy(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4651 {
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4652 HWND frame, menu, parent;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4653
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4654 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
4655 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
4656
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4657 /* 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
4658 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
4659 {
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4660 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
4661
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4662 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
4663 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
4664
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4665 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
4666 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
4667 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
4668 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4669
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4670 parent = WinQueryWindow(handle, QW_PARENT);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4671 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
4672
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4673 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4674 _free_menu_data(menu);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4675
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
4676 /* 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
4677 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
4678 {
1667
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
4679 dw_box_remove(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4680 _free_window_memory(frame ? frame : handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4681 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4682 return WinDestroyWindow(frame ? frame : handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4683 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4684
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
4685 /* 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
4686 * 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
4687 * 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
4688 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4689 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
4690 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4691 HWND client = WinWindowFromID(handle, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4692 HWND window = client ? client : handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4693 Box *mybox = (Box *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4694
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4695 _fix_button_owner(_toplevel_window(handle), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4696 if(window && mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4697 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4698 unsigned long width, height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4699
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4700 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
4701
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
4702 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
4703 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
4704
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
4705 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
4706 _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
4707 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
4708 }
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
4709 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4710
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4711 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4712 * Changes a window's parent to newparent.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4713 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4714 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4715 * newparent: The window's new parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4716 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4717 void API dw_window_reparent(HWND handle, HWND newparent)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4718 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4719 HWND blah = WinWindowFromID(newparent, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4720 WinSetParent(handle, blah ? blah : newparent, TRUE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4721 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4722
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4723 /* 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
4724 * Parameters:
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4725 * currfont: current font
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4726 * Returns:
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4727 * 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
4728 */
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4729 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
4730 {
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
4731 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
4732 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
4733 int size = 9;
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4734
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4735 /* 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
4736 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
4737 {
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
4738 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
4739 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
4740 {
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
4741 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
4742 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
4743 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
4744 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
4745 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
4746 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
4747 }
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
4748 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
4749 {
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
4750 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
4751 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
4752 }
1690
0f4bbb78f149 Ugg this stupid editor keeps adding tabs!
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1689
diff changeset
4753 }
1689
3fb7002e4de6 Unicode (UTF-8) mode on OS/2 as noted to me by Alex Taylor comes with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1688
diff changeset
4754 #ifdef UNICODE
1690
0f4bbb78f149 Ugg this stupid editor keeps adding tabs!
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1689
diff changeset
4755 fd.fAttrs.usCodePage = 1208;
1689
3fb7002e4de6 Unicode (UTF-8) mode on OS/2 as noted to me by Alex Taylor comes with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1688
diff changeset
4756 #endif
1676
007bced14910 Explicitly set codepage 1208 for GPI rendering on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1673
diff changeset
4757 fd.fAttrs.usRecordLength = sizeof(FATTRS);
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4758
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4759 /* 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
4760 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
4761 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
4762 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
4763 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
4764 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
4765 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
4766 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
4767 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
4768 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
4769
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4770 /* 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
4771 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
4772 {
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
4773 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
4774 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
4775 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
4776 }
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
4777 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
4778 /* 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
4779 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
4780 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
4781 return buf;
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4782 }
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4783
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4784 /*
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
4785 * 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
4786 * 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
4787 * 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
4788 */
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
4789 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
4790 {
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
4791 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
4792
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
4793 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
4794 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
4795 }
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
4796
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
4797 /* 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
4798 * 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
4799 */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4800 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
4801 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4802 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
4803 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
4804
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4805 /* 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
4806 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
4807 {
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
4808 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
4809 {
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
4810 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
4811 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
4812
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
4813 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
4814 {
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
4815 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
4816 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
4817 }
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
4818 }
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
4819 }
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
4820 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
4821 }
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
4822
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
4823 /* 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
4824 * 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
4825 *
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
4826 * 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
4827 * 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
4828 * 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
4829 * 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
4830 * 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
4831 * 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
4832 * 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
4833 */
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
4834 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
4835 {
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
4836 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
4837 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
4838 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
4839
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4840 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
4841
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4842 /* 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
4843 * 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
4844 */
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4845 if(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
4846 {
22ba64e357de Initial versions of code to figure out control sizes for Windows and OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1409
diff changeset
4847 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
4848 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
4849 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
4850 }
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
4851
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
4852 /* Combobox */
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4853 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
4854 {
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
4855 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
4856 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
4857 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
4858 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
4859 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
4860 }
1534
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4861 /* Calendar */
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4862 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
4863 {
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4864 thiswidth = 200;
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4865 thisheight = 150;
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
4866 }
1423
1bb1865fed9d Revert experimental GTK2 change and add OS/2 support for auto-redrawing and auto-calculating bitmaps and bitmap buttons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1417
diff changeset
4867 /* 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
4868 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
4869 {
1737
46c2846e5750 Need to get the bitmap from window data instead on OS/2 now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1736
diff changeset
4870 HBITMAP hbm = (HBITMAP)dw_window_get_data(handle, "_dw_bitmap");
1424
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4871
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
4872 /* If we got a bitmap handle */
1424
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4873 if(hbm)
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4874 {
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4875 BITMAPINFOHEADER2 bmp;
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4876 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
4877 /* 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
4878 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
4879 {
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4880 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
4881 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
4882 }
36d0e26a5dea Use the image handle to get the dimensions on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1423
diff changeset
4883 }
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
4884 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
4885 {
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
4886 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
4887 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
4888 }
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
4889 }
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
4890 /* 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
4891 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
4892 {
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
4893 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
4894 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
4895 }
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
4896 /* 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
4897 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
4898 {
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
4899 /* 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
4900 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
4901 {
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
4902 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
4903 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
4904 }
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
4905 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
4906 {
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
4907 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
4908 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
4909 }
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
4910 }
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4911 /* Spinbutton */
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4912 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
4913 {
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
4914 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
4915 thiswidth = 50;
1459
98de42fc664d Add missing extra height from spinbuttons OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1458
diff changeset
4916 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
4917 }
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4918 /* Entryfield */
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
4919 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
4920 {
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
4921 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
4922 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
4923 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
4924 }
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4925 /* MLE */
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4926 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
4927 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4928 unsigned long bytes;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4929 int height, width;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4930 char *buf, *ptr;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4931 int basicwidth;
1548
ef7959aae8da Clean up some warnings with GCC on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1547
diff changeset
4932 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
4933
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4934 thisheight = 8;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4935 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
4936
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4937 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
4938
1548
ef7959aae8da Clean up some warnings with GCC on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1547
diff changeset
4939 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
4940 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
4941 buf[bytes] = 0;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4942 strcat(buf, "\n");
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4943
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4944 /* MLE */
1693
b2311922a4de Ah so... eliminated the last few VAC36 warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1692
diff changeset
4945 while((ptr = strstr(buf, "\n")) != NULL)
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4946 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4947 ptr[0] = 0;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4948 width = 0;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4949 if(strlen(buf))
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4950 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
4951 else
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4952 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
4953
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4954 width += basicwidth;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4955
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4956 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
4957 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4958 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
4959 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
4960
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4961 }
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4962 else
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4963 {
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4964 if(width > thiswidth)
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4965 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
4966 }
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4967 thisheight += height;
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4968 buf = &ptr[1];
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4969 }
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4970
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
4971 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
4972 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
4973 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
4974 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
4975 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
4976 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
4977 }
1570
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4978 /* Listbox */
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4979 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
4980 {
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4981 char buf[1025] = {0};
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4982 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
4983 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
4984
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4985 thisheight = 8;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4986
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4987 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
4988 {
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4989 int height, width = 0;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4990
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4991 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
4992
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4993 if(strlen(buf))
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4994 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
4995 else
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4996 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
4997
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4998 width += basicwidth;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
4999
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
5000 if(width > thiswidth)
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
5001 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
5002 thisheight += height;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
5003 }
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
5004
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
5005 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
5006 thiswidth = _DW_SCROLLED_MIN_WIDTH;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
5007 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
5008 thisheight = _DW_SCROLLED_MIN_HEIGHT;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
5009 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
5010 thisheight = _DW_SCROLLED_MAX_HEIGHT;
d6988022c5cf Implemented listbox sizing on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1569
diff changeset
5011 }
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
5012 /* Container and Tree */
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
5013 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
5014 {
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5015 /* Container */
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5016 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
5017 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5018 CNRINFO ci;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5019
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5020 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
5021 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5022 RECTL item;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5023 PRECORDCORE pCore = NULL;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5024 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
5025 /* 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
5026 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
5027
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5028 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
5029 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
5030
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5031 /* 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
5032 if(ci.pFieldInfoLast)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5033 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5034 right = TRUE;
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5035 /* 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
5036 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
5037 /* 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
5038 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
5039 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5040
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5041 /* 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
5042 if(title)
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5043 {
1569
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5044 unsigned long height = 0;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5045
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5046 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
5047 if(height)
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5048 thisheight += height;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5049 else
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5050 thisheight += 28;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5051 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5052
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5053 /* 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
5054 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
5055
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5056 /* 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
5057 if(pCore)
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5058 {
1569
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5059 while(pCore)
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5060 {
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5061 QUERYRECORDRECT qrr;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5062 int vector;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5063
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5064 qrr.cb = sizeof(QUERYRECORDRECT);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5065 qrr.pRecord = pCore;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5066 qrr.fRightSplitWindow = right;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5067 qrr.fsExtent = CMA_TEXT;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5068
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5069 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
5070
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5071 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
5072
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5073 if(vector > max)
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5074 max = vector;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5075
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5076 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
5077
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5078 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
5079 }
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5080
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5081 /* 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
5082 thiswidth += max;
1568
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5083 }
1569
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5084 else
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5085 {
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5086 /* Method 2: No items */
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5087 unsigned long width, height;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5088 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
5089 MRESULT mr;
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5090
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5091 /* Save the original size */
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5092 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
5093
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5094 /* 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
5095 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
5096
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5097 /* 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
5098 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
5099 if(right)
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5100 thiswidth += SHORT2FROMMP(mr);
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5101 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
5102 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
5103
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5104 /* Reload the original size */
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5105 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
5106 }
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5107
866d7d05d425 Added second calculation method for container on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1568
diff changeset
5108 /* 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
5109 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
5110 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
5111 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
5112 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
5113 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
5114 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
5115 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
5116 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
5117 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5118 }
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5119 else
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5120 {
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5121 /* Tree */
625c4d1555fe Added code to calculate the container size on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1567
diff changeset
5122 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
5123 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
5124 }
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
5125 }
1412
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
5126 /* Button */
246aadf8fbd4 Fixes for the OS/2 code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1411
diff changeset
5127 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
5128 {
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
5129 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
5130
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
5131 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
5132 {
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
5133 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
5134 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
5135 }
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
5136 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
5137 {
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
5138 /* 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
5139 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
5140 {
1658
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5141 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
5142 HBITMAP hbm = 0;
1661
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5143 int iconwidth = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_button_icon_width"));
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
5144 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap");
1658
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5145
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5146 /* 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
5147 if(hpr)
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5148 {
1661
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5149 if(iconwidth)
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5150 thisheight = thiswidth = iconwidth;
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5151 else
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5152 {
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5153 POINTERINFO pi;
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5154
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5155 /* Get the internal HBITMAP handles */
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5156 if(WinQueryPointerInfo(hpr, &pi))
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5157 hbm = pi.hbmColor ? pi.hbmColor : pi.hbmPointer;
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5158 }
1658
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5159 }
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
5160 /* Handle case of pixmap resource */
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
5161 else if(pixmap)
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
5162 {
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
5163 thiswidth = pixmap->width;
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
5164 thisheight = pixmap->height;
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
5165 }
1658
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5166
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5167 /* If we didn't load it from the icon... */
1661
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
5168 if(!hbm && !iconwidth)
1658
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5169 {
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5170 WNDPARAMS wp;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5171 BTNCDATA bcd;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5172
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5173 wp.fsStatus = WPM_CTLDATA;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5174 wp.cbCtlData = sizeof(BTNCDATA);
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5175 wp.pCtlData = &bcd;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5176
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5177 /* 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
5178 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
5179 hbm = bcd.hImage;
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5180 }
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5181
6fe1e91da477 Added DW_POINTER() macro for casting parameters to (void *)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1654
diff changeset
5182 /* 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
5183 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
5184 {
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
5185 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
5186 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
5187 /* 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
5188 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
5189 {
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
5190 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
5191 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
5192 }
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
5193 }
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
5194 }
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
5195 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
5196 {
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
5197 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
5198 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
5199 }
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
5200 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
5201 {
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
5202 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
5203 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
5204 }
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
5205 }
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
5206 }
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
5207
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
5208 /* 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
5209 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
5210 *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
5211 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
5212 *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
5213 }
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
5214
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
5215 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5216 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5217 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5218 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5219 * fontname: Name and size of the font in the form "size.fontname"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5220 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5221 int API dw_window_set_font(HWND handle, char *fontname)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5222 {
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
5223 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
5224 /* 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
5225 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
5226 {
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
5227 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
5228
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
5229 /* 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
5230 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
5231 {
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
5232 _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
5233 /* 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
5234 _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
5235 }
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
5236 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
5237 }
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
5238 return DW_ERROR_UNKNOWN;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5239 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5240
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5241 /*
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5242 * 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
5243 * Parameters:
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5244 * 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
5245 * 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
5246 */
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5247 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
5248 {
1010
9af693aafa93 Attempt at implmenting dw_window_get_font on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1009
diff changeset
5249 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
5250 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
5251 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
5252 return strdup(str);
9af693aafa93 Attempt at implmenting dw_window_get_font on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1009
diff changeset
5253 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
5254 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5255
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5256 /* 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
5257 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
5258 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5259 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
5260
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5261
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5262 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
5263 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
5264
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5265 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
5266 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
5267 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5268 HWND child;
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5269 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
5270
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5271 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
5272 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5273 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
5274 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5275 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
5276 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5277 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5278 WinEndEnumWindows(henum);
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5279 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5280 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5281
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5282 /* Internal version */
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5283 int _dw_window_set_color(HWND handle, ULONG fore, ULONG back)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5284 {
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5285 /* Handle foreground */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5286 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5287 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5288 RGB2 rgb2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5289
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5290 rgb2.bBlue = DW_BLUE_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5291 rgb2.bGreen = DW_GREEN_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5292 rgb2.bRed = DW_RED_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5293 rgb2.fcOptions = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5294
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5295 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5296
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5297 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5298 else if(fore != DW_CLR_DEFAULT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5299 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5300 fore = _internal_color(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5301
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5302 WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5303 }
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5304 /* Handle background */
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5305 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
5306 {
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5307 /* 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
5308 ULONG pcolor;
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5309 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
5310
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5311 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
5312
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5313 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
5314 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
5315 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
5316 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
5317 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
5318 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
5319 }
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5320 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
5321 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5322 RGB2 rgb2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5323
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5324 rgb2.bBlue = DW_BLUE_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5325 rgb2.bGreen = DW_GREEN_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5326 rgb2.bRed = DW_RED_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5327 rgb2.fcOptions = 0;
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 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2);
1688
72ac6eb33d76 Fixed dw_window_set_color() not removing the transparent flag on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1687
diff changeset
5330 dw_window_set_data(handle, "_dw_transparent", NULL);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5331 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5332 else if(back != DW_CLR_DEFAULT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5333 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5334 back = _internal_color(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5335
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5336 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back);
1688
72ac6eb33d76 Fixed dw_window_set_color() not removing the transparent flag on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1687
diff changeset
5337 dw_window_set_data(handle, "_dw_transparent", NULL);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5338 }
1428
7826031d48ce Added support for pseudo transparent widget background colors on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1425
diff changeset
5339 /* 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
5340 _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
5341 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5342 }
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5343 /*
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5344 * 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
5345 * Parameters:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5346 * handle: The window (widget) handle.
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5347 * 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
5348 * 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
5349 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5350 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
5351 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5352 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
5353 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
5354
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5355 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
5356 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5357
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5358 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5359 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5360 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5361 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5362 * border: Size of the window border in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5363 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5364 int API dw_window_set_border(HWND handle, int border)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5365 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5366 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5367 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5368 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5369
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5370 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5371 * Captures the mouse input to this window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5372 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5373 * handle: Handle to receive mouse input.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5374 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5375 void API dw_window_capture(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5376 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5377 WinSetCapture(HWND_DESKTOP, handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5378 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5379
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5380 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5381 * Releases previous mouse capture.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5382 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5383 void API dw_window_release(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5384 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5385 WinSetCapture(HWND_DESKTOP, NULLHANDLE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5386 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5387
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5388 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5389 * Tracks this window movement.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5390 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5391 * handle: Handle to frame to be tracked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5392 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5393 void API dw_window_track(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5394 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5395 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5396 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5397
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5398 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5399 * 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
5400 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5401 * 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
5402 * 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
5403 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
5404 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
5405 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5406 HPOINTER pointer = pointertype < 65535 ?
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5407 WinQuerySysPointer(HWND_DESKTOP, pointertype, FALSE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5408 : (HPOINTER)pointertype;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5409
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5410 if(!pointertype)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5411 dw_window_set_data(handle, "_dw_pointer", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5412 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5413 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5414 WinSetPointer(HWND_DESKTOP, pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5415
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5416 if(handle != HWND_DESKTOP)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5417 dw_window_set_data(handle, "_dw_pointer", (void *)pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5418 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5419 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5420
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5421 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5422 * Create a new Window Frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5423 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5424 * owner: The Owner's window handle or HWND_DESKTOP.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5425 * title: The Window title.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5426 * flStyle: Style flags, see the PM reference.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5427 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5428 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5429 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5430 HWND hwndframe;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5431 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5432 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5433 ULONG winStyle = 0L;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5434
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5435 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
5436 newbox->vsize = newbox->hsize = SIZEEXPAND;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5437
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5438 flStyle |= FCF_NOBYTEALIGN;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5439
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5440 if(flStyle & DW_FCF_TITLEBAR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5441 newbox->titlebar = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5442 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5443 flStyle |= FCF_TITLEBAR;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5444
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5445 if(flStyle & WS_MAXIMIZED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5446 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5447 winStyle |= WS_MAXIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5448 flStyle &= ~WS_MAXIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5449 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5450 if(flStyle & WS_MINIMIZED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5451 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5452 winStyle |= WS_MINIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5453 flStyle &= ~WS_MINIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5454 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5455
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
5456 /* 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
5457 flStyle &= ~FCF_SHELLPOSITION;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5458 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
5459 /* 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
5460 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
5461 newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5462 if(!newbox->titlebar && newbox->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5463 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5464 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5465 WinSetWindowPtr(hwndframe, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5466 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5467 return hwndframe;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5468 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5469
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5470 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5471 * Create a new Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5472 * 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
5473 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5474 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5475 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5476 HWND API dw_box_new(int type, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5477 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5478 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5479
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5480 newbox->pad = pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5481 newbox->type = type;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5482 newbox->count = 0;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
5483 newbox->grouphwnd = NULLHANDLE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5484
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5485 newbox->hwnd = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5486 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5487 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5488 WS_VISIBLE | WS_CLIPCHILDREN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5489 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5490 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5491 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5492 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5493 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5494 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5495 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5496
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5497 newbox->oldproc = WinSubclassWindow(newbox->hwnd, _controlproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5498 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5499 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
5500 return newbox->hwnd;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5501 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5502
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5503 /*
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5504 * 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
5505 * Parameters:
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5506 * 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
5507 * 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
5508 */
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5509 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
5510 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5511 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
5512 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
5513 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
5514 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
5515 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
5516 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
5517 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
5518 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
5519 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
5520 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
5521 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
5522 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
5523 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
5524 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
5525 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
5526 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
5527 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
5528 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
5529 return hwndframe;
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5530 }
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5531
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
5532 /*
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5533 * 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
5534 * 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
5535 * 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
5536 * 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
5537 */
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5538 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
5539 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5540 HWND scroll;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5541
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5542 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
5543 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5544 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
5545 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5546 else
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5547 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5548 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
5549 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5550 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
5551 }
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5552
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5553 /*
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5554 * 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
5555 * 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
5556 * 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
5557 * 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
5558 */
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5559 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
5560 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5561 HWND scroll;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5562
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5563 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
5564 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5565 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
5566 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5567 else
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5568 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5569 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
5570 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
5571 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
5572 }
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
5573
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
5574 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5575 * Create a new Group Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5576 * 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
5577 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5578 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5579 * title: Text to be displayined in the group outline.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5580 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5581 HWND API dw_groupbox_new(int type, int pad, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5582 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5583 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5584 newbox->pad = pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5585 newbox->type = type;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5586 newbox->count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5587
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5588 newbox->hwnd = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5589 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5590 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5591 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5592 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5593 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5594 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5595 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5596 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5597 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5598 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5599
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5600 newbox->grouphwnd = WinCreateWindow(newbox->hwnd,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5601 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5602 (PSZ)title,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5603 WS_VISIBLE | SS_GROUPBOX |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5604 WS_GROUP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5605 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5606 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5607 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5608 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5609 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5610 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5611
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5612 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5613 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
5614 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
5615 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
5616 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
5617 return newbox->hwnd;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5618 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5619
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5620 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5621 * 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
5622 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5623 * 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
5624 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5625 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
5626 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5627 HWND hwndframe;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5628 ULONG back = CLR_DARKGRAY;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5629
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5630 hwndframe = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5631 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5632 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5633 WS_VISIBLE | WS_CLIPCHILDREN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5634 FS_NOBYTEALIGN,
1488
6771fa426ba4 Added auto-positioning and auto-sizing code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1483
diff changeset
5635 0,0,0,0,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5636 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5637 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5638 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5639 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5640 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5641 /* 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
5642 WinSetPresParam(hwndframe, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5643 return hwndframe;
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5644 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5645
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
5646 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5647 * Create a bitmap object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5648 * 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
5649 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5650 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5651 HWND API dw_bitmap_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5652 {
1736
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5653 WindowData *blah = calloc(1, sizeof(WindowData));
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5654 HWND tmp = WinCreateWindow(HWND_OBJECT,
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5655 WC_STATIC,
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5656 NULL,
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5657 WS_VISIBLE | SS_TEXT,
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5658 0,0,0,0,
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5659 NULLHANDLE,
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5660 HWND_TOP,
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5661 id,
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5662 NULL,
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5663 NULL);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5664 blah->oldproc = WinSubclassWindow(tmp, _BitmapProc);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5665 WinSetWindowPtr(tmp, QWP_USER, blah);
43accf95bdc3 Subclass the bitmap widget to center the bitmap on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1733
diff changeset
5666 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5667 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5668
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5669 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5670 * Create a notebook object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5671 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5672 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5673 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5674 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5675 HWND API dw_notebook_new(ULONG id, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5676 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5677 ULONG flags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5678 HWND tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5679
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5680 if(top)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5681 flags = BKS_MAJORTABTOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5682 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5683 flags = BKS_MAJORTABBOTTOM;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5684
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5685 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5686 WC_NOTEBOOK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5687 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5688 WS_VISIBLE |
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
5689 #ifdef BKS_TABBEDDIALOG
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5690 BKS_TABBEDDIALOG |
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
5691 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5692 flags,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5693 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5694 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5695 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5696 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5697 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5698 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5699
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5700 /* Fix tab sizes on Warp 3 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5701 if(!IS_WARP4())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5702 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5703 /* best sizes to be determined by trial and error */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5704 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
5705 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5706
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5707 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5708 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5709 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5710
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5711 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5712 * Create a menu object to be popped up.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5713 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5714 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5715 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5716 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5717 HMENUI API dw_menu_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5718 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5719 HMENUI tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5720 WC_MENU,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5721 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5722 WS_VISIBLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5723 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5724 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5725 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5726 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5727 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5728 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5729 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5730 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5731
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5732 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5733 * Create a menubar on a window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5734 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5735 * location: Handle of a window frame to be attached to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5736 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5737 HMENUI API dw_menubar_new(HWND location)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5738 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5739 HMENUI tmp = WinCreateWindow(location,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5740 WC_MENU,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5741 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5742 WS_VISIBLE | MS_ACTIONBAR,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5743 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5744 location,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5745 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5746 FID_MENU,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5747 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5748 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5749 dw_window_set_data(tmp, "_dw_owner", (void *)location);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5750 dw_window_set_data(tmp, "_dw_menubar", (void *)location);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5751 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5752 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5753
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5754 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5755 * Destroys a menu created with dw_menubar_new or dw_menu_new.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5756 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5757 * menu: Handle of a menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5758 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5759 void API dw_menu_destroy(HMENUI *menu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5760 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5761 if(menu)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5762 WinDestroyWindow(*menu);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5763 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5764
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
5765 /* 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
5766 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
5767 {
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
5768 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
5769
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
5770 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
5771 {
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
5772 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
5773 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
5774 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
5775 }
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
5776 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
5777 }
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
5778
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5779 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5780 * Adds a menuitem or submenu to an existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5781 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5782 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5783 * title: The title text on the menu item to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5784 * id: An ID to be used for message passing.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5785 * flags: Extended attributes to set on the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5786 * end: If TRUE memu is positioned at the end of the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5787 * 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
5788 * flags: Extended attributes to set on the menu.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5789 * submenu: Handle to an existing menu to be a submenu or NULL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5790 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5791 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
5792 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5793 MENUITEM miSubMenu;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5794 char buffer[30];
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5795 int is_checked, is_disabled;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5796
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
5797 if ( !menux || !WinIsWindow(dwhab, menux) )
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5798 return NULLHANDLE;
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 if ( end )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5801 miSubMenu.iPosition=MIT_END;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5802 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5803 miSubMenu.iPosition=0;
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 * Handle flags
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5806 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5807 miSubMenu.afAttribute = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5808 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
5809 if ( is_checked )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5810 miSubMenu.afAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5811 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
5812 if ( is_disabled )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5813 miSubMenu.afAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5814
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
5815 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
5816 {
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
5817 /* 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
5818 * 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
5819 */
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
5820 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
5821 {
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
5822 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
5823
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
5824 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
5825 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
5826
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
5827 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
5828 tempid = 61000;
1316
3475887f9445 Fixed tabs inserted by my editor on OS/2 again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1315
diff changeset
5829 }
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
5830 /* 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
5831 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
5832 {
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
5833 check = 0;
1316
3475887f9445 Fixed tabs inserted by my editor on OS/2 again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1315
diff changeset
5834 }
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
5835 /* 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
5836 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
5837 {
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
5838 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
5839
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
5840 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
5841 {
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
5842 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
5843 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
5844 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
5845 }
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
5846 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
5847 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
5848 }
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
5849 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
5850 }
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
5851 else
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5852 miSubMenu.afStyle = MIS_SEPARATOR;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5853 miSubMenu.id=id;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5854 miSubMenu.hwndSubMenu = submenu;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5855 miSubMenu.hItem=NULLHANDLE;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5856
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5857 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
5858
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5859 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
5860 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
5861 sprintf(buffer, "_dw_checkable%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5862 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
5863 sprintf(buffer, "_dw_ischecked%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5864 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
5865 sprintf(buffer, "_dw_isdisabled%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5866 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
5867
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5868 if ( submenu )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5869 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
5870 return (HWND)id;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5871 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5872
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5873 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5874 * 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
5875 * Deprecated; use dw_menu_item_set_state()
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5876 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5877 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5878 * id: Menuitem id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5879 * check: TRUE for checked FALSE for not checked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5880 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5881 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5882 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5883 if ( check )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5884 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
5885 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5886 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
5887 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5888
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5889 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5890 * 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
5891 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5892 * 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
5893 * id: Menuitem id.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5894 * 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
5895 * DW_MIS_CHECKED/DW_MIS_UNCHECKED
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5896 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5897 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
5898 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5899 char buffer1[30],buffer2[30];
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5900 int check;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5901 int disabled;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5902 USHORT fAttribute=0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5903
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5904 sprintf( buffer1, "_dw_ischecked%ld", id );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5905 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
5906 sprintf( buffer2, "_dw_isdisabled%ld", id );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5907 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
5908
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5909 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
5910 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5911 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5912 * 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
5913 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5914 if ( state & DW_MIS_CHECKED )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5915 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5916 fAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5917 check = 1;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5918 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5919 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5920 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5921 check = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5922 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5923 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5924 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5925 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5926 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5927 * ...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
5928 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5929 if ( check )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5930 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5931 fAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5932 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5933 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5934 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
5935 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5936 if ( state & DW_MIS_DISABLED )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5937 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5938 fAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5939 disabled = 1;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5940 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5941 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5942 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5943 disabled = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5944 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5945 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5946 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5947 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5948 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5949 * ...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
5950 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5951 if ( disabled )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5952 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5953 fAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5954 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5955 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5956 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
5957 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5958 * Keep our internal checked state consistent
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5959 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5960 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
5961 dw_window_set_data( hwndApp, buffer2, (void *)disabled );
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5962 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5963
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5964 /*
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5965 * 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
5966 * Parameters:
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5967 * 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
5968 * 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
5969 * Returns:
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5970 * 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
5971 */
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5972 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
5973 {
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
5974 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
5975 {
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5976 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
5977 /* 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
5978 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
5979 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
5980 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
5981 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5982 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
5983 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5984
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5985 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5986 * Pops up a context menu at given x and y coordinates.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5987 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5988 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5989 * parent: Handle to the window initiating the popup.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5990 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5991 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5992 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5993 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5994 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5995 if(menu)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5996 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5997 popup = parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5998 dw_window_set_data(*menu, "_dw_popup", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5999 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
6000 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6001 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6002
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6003 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6004 * Returns the current X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6005 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6006 * x: Pointer to variable to store X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6007 * y: Pointer to variable to store Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6008 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6009 void API dw_pointer_query_pos(long *x, long *y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6010 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6011 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6012
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6013 WinQueryPointerPos(HWND_DESKTOP, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6014 if(x && y)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6015 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6016 *x = ptl.x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6017 *y = dw_screen_height() - ptl.y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6018 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6019 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6020
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6021 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6022 * Sets the X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6023 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6024 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6025 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6026 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6027 void API dw_pointer_set_pos(long x, long y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6028 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6029 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6030 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6031
310
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
6032
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6033 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6034 * Create a container object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6035 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6036 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6037 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6038 */
350
2216e65ad2ae Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 347
diff changeset
6039 HWND API dw_container_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6040 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6041 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6042 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6043 WC_CONTAINER,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6044 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6045 WS_VISIBLE | CCS_READONLY |
1029
60d6d2c87116 Switched back to CCS_EXTENDSEL from CCS_MULTIPLESEL...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1024
diff changeset
6046 (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) |
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6047 CCS_AUTOPOSITION,
1547
2fd9ff675d79 Added autosize code for the MLE on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1544
diff changeset
6048 0,0,0,0,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6049 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6050 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
6051 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6052 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6053 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6054 blah->oldproc = WinSubclassWindow(tmp, _TreeProc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6055 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6056 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6057 dw_window_set_data(tmp, "_dw_container", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6058 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6059 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6060
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6061 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6062 * 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
6063 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6064 * 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
6065 * 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
6066 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6067 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
6068 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6069 CNRINFO cnrinfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6070 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6071 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6072 WC_CONTAINER,
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 WS_VISIBLE | CCS_READONLY |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6075 CCS_SINGLESEL | CCS_AUTOPOSITION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6076 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6077 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6078 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
6079 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6080 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6081 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6082
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6083 cnrinfo.flWindowAttr = CV_TREE | CA_TREELINE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6084 cnrinfo.slBitmapOrIcon.cx = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6085 cnrinfo.slBitmapOrIcon.cy = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6086 cnrinfo.cyLineSpacing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6087 cnrinfo.cxTreeIndent = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6088 cnrinfo.cxTreeLine = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6089
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6090 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
6091 CMA_LINESPACING | CMA_CXTREEINDENT | CMA_CXTREELINE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6092 blah->oldproc = WinSubclassWindow(tmp, _TreeProc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6093 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6094 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6095 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
6096 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6097
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6098 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6099 * Create a new static text window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6100 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6101 * 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
6102 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6103 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6104 HWND API dw_text_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6105 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6106 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6107 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6108 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6109 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6110 WS_VISIBLE | SS_TEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6111 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6112 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6113 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6114 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6115 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6116 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6117 blah->oldproc = WinSubclassWindow(tmp, _textproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6118 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6119 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
6120 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
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 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
6125 * 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
6126 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
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.
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
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_status_text_new(char *text, ULONG id)
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
6131 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6132 WindowData *blah = calloc(sizeof(WindowData), 1);
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_STATIC,
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 | SS_TEXT,
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 blah->oldproc = WinSubclassWindow(tmp, _statusproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6144 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6145 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6146 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
6147 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
6148 return tmp;
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
6149 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
6150
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
6151 #ifndef MLS_LIMITVSCROLL
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
6152 #define MLS_LIMITVSCROLL 0x00000080L
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
6153 #endif
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
6154
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
6155 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6156 * Create a new Multiline Editbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6157 * 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
6158 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6159 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6160 HWND API dw_mle_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6161 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6162 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6163 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6164 WC_MLE,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6165 NULL,
1544
1fd3a9635c4d Enable MLE line wrap by default on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1537
diff changeset
6166 WS_VISIBLE | MLS_WORDWRAP |
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6167 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
6168 MLS_VSCROLL | MLS_LIMITVSCROLL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6169 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6170 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6171 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6172 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6173 NULL,
996
69cf9f26e899 Removed some code I accidentally commited to the OS/2 module.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 995
diff changeset
6174 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
6175 WinSendMsg(tmp, MLM_FORMAT, (MPARAM)MLFIE_NOTRANS, 0);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6176 blah->oldproc = WinSubclassWindow(tmp, _mleproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6177 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6178 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6179 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6180 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6181
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6182 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6183 * Create a new Entryfield window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6184 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6185 * 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
6186 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6187 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6188 HWND API dw_entryfield_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6189 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6190
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6191 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6192 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6193 WC_ENTRYFIELD,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6194 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6195 WS_VISIBLE | ES_MARGIN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6196 ES_AUTOSCROLL | WS_TABSTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6197 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6198 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6199 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6200 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6201 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6202 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6203 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6204 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6205 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6206 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
6207 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6208 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6209
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6210 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6211 * Create a new Entryfield (password) window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6212 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6213 * 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
6214 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6215 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6216 HWND API dw_entryfield_password_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6217 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6218 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6219 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6220 WC_ENTRYFIELD,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6221 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6222 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6223 ES_AUTOSCROLL | WS_TABSTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6224 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6225 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6226 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6227 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6228 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6229 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6230 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6231 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6232 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6233 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
6234 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6235 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6236
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6237 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6238 * Create a new Combobox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6239 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6240 * 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
6241 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6242 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6243 HWND API dw_combobox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6244 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6245 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6246 HWND frame = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6247 HWND tmp = WinCreateWindow(frame,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6248 WC_COMBOBOX,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6249 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6250 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6251 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6252 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6253 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
6254 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6255 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6256 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6257 HENUM henum = WinBeginEnumWindows(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6258 HWND child, last = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6259
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6260 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6261 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6262 WindowData *moreblah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6263 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6264 WinSetWindowPtr(child, QWP_USER, moreblah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6265 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
6266 last = child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6267 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6268 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6269 blah->oldproc = WinSubclassWindow(tmp, _comboproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6270 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6271 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6272 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
6273 dw_window_set_data(tmp, "_dw_comboentry", (void *)last);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6274 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
6275 WinSetOwner(tmp, frame);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6276 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6277 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6278
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6279 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6280 * Create a new button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6281 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6282 * 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
6283 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6284 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6285 HWND API dw_button_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6286 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6287 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6288 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6289 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6290 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6291 WS_VISIBLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6292 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6293 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6294 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6295 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6296 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6297 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6298
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6299 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6300
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6301 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6302 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6303 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
6304 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6305 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6306
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6307 /* Function: GenResIDStr
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6308 ** Abstract: Generate string '#nnnn' for a given ID for using with Button
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6309 ** controls
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6310 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6311
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6312 void _GenResIDStr(CHAR *buff, ULONG ulID)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6313 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6314 char *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6315 int slen = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6316
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6317 *buff++ = '#';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6318
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6319 str = buff;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6320
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6321 do
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6322 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6323 *str++ = (ulID % 10) + '0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6324 ulID /= 10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6325 slen++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6326 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6327 while(ulID);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6328
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6329 *str-- = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6330
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6331 for(; str > buff; str--, buff++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6332 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6333 *buff ^= *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6334 *str ^= *buff;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6335 *buff ^= *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6336 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6337 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6338
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6339
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6340 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6341 * Create a new bitmap button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6342 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6343 * text: Bubble help text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6344 * id: An ID of a bitmap in the resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6345 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6346 HWND API dw_bitmapbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6347 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6348 char idbuf[256], *name = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6349 HWND tmp;
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6350 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6351 HPOINTER icon = WinLoadPointer(HWND_DESKTOP, 0L, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6352
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6353 if(!icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6354 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6355 name = idbuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6356 _GenResIDStr(idbuf, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6357 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6358
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6359 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6360 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6361 (PSZ)name,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6362 WS_VISIBLE | BS_PUSHBUTTON |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6363 BS_NOPOINTERFOCUS | BS_AUTOSIZE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6364 (icon ? 0 : BS_BITMAP),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6365 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6366 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6367 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6368 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6369 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6370 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6371
1397
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6372 if(text)
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6373 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
6374 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
6375
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6376 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6377
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6378 if(icon)
1661
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6379 {
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6380 PVOID ResPtr;
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6381 ULONG ResSize;
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6382
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6383 /* Since WinLoadPointer() can change the size of the icon...
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6384 * We will query the resource directly and check the size ourselves.
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6385 */
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6386 if(DosQueryResourceSize(NULLHANDLE, RT_POINTER, id, &ResSize) == NO_ERROR && ResSize &&
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6387 DosGetResource(NULLHANDLE, RT_POINTER, id, &ResPtr) == NO_ERROR)
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6388 {
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6389 PBITMAPFILEHEADER2 header = ResPtr;
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6390
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6391 /* We can only check for icons and pointers */
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6392 if(header->usType == 0x4943 /* Icon 'CI' */ ||
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6393 header->usType == 0x5043 /* Pointer 'CP' */)
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6394 {
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6395 /* Check the new style header */
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6396 if(header->bmp2.cbFix == sizeof(BITMAPINFOHEADER2))
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6397 dw_window_set_data(tmp, "_dw_button_icon_width", DW_INT_TO_POINTER(header->bmp2.cx));
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6398 else if(header->bmp2.cbFix == sizeof(BITMAPINFOHEADER))
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6399 {
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6400 /* Check the old style header */
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6401 PBITMAPINFOHEADER bi = (PBITMAPINFOHEADER)&(header->bmp2);
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6402
1670
86d7bce8f4c6 Fix warning with gcc no OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1669
diff changeset
6403 dw_window_set_data(tmp, "_dw_button_icon_width", DW_INT_TO_POINTER(((int)bi->cx)));
1661
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6404 }
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6405 }
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6406 DosFreeResource(ResPtr);
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6407 }
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6408 dw_window_set_data(tmp, "_dw_button_icon", DW_POINTER(icon));
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6409 }
fc135161f2b1 Workaround WinLoadPointer() modifying the icon size on OS/2 by
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1658
diff changeset
6410 dw_window_set_data(tmp, "_dw_bitmapbutton", DW_INT_TO_POINTER(1));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6411 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6412 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6413
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6414 /*
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6415 * 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
6416 * Parameters:
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6417 * 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
6418 * 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
6419 * 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
6420 * 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
6421 * (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
6422 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
6423 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
6424 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6425 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
6426 HWND tmp = WinCreateWindow(HWND_OBJECT,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6427 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6428 NULL,
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6429 WS_VISIBLE | BS_PUSHBUTTON |
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6430 BS_AUTOSIZE | BS_NOPOINTERFOCUS,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6431 0,0,2000,1000,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6432 NULLHANDLE,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6433 HWND_TOP,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6434 id,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6435 NULL,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6436 NULL);
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
6437 char *file = alloca(strlen(filename) + 6);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6438 HPIXMAP pixmap = NULL, disabled = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6439 HPOINTER icon = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6440
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6441 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
6442 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6443 int z, j, lim, len;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6444 LONG fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6445
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6446 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6447
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6448 /* 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
6449 if(access(file, 04) == 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6450 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6451 len = strlen( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6452 if(len > 4)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6453 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6454 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
6455 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6456 else
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
6457 _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6458 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6459 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6460 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6461 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6462 /* Try with .ico extension first...*/
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6463 strcat(file, ".ico");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6464 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
6465 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6466 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6467 {
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
6468 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++)
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
6469 {
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
6470 strcpy(file, filename);
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
6471 strcat(file, image_exts[z]);
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
6472 if(access(file, 04) == 0 &&
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
6473 _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth))
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
6474 break;
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
6475 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6476 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6477 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6478
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6479 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6480 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6481 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6482 pixmap = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6483 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6484 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6485 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6486 /* Create a disabled style pixmap */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6487 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
6488 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
6489
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6490 fore = _foreground;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6491 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
6492 lim = pixmap->width/2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6493 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
6494 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6495 int mod = j%2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6496
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6497 for(z=0;z<lim;z++)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6498 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
6499 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6500 _foreground = fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6501 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6502 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6503
1397
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6504 if(text)
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6505 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
6506 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6507
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6508 WinSetWindowPtr(tmp, QWP_USER, blah);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6509
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6510 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6511 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
6512 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6513 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6514 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
6515 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
6516 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6517 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
6518 return tmp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6519 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6520
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6521 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6522 * 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
6523 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6524 * 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
6525 * 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
6526 * data: The contents of the image
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6527 * (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
6528 * len: length of str
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6529 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6530 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
6531 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6532 FILE *fp;
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6533 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
6534 HWND tmp = WinCreateWindow(HWND_OBJECT,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6535 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6536 NULL,
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6537 WS_VISIBLE | BS_PUSHBUTTON |
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6538 BS_AUTOSIZE | BS_NOPOINTERFOCUS,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6539 0,0,2000,1000,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6540 NULLHANDLE,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6541 HWND_TOP,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6542 id,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6543 NULL,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6544 NULL);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6545 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6546 HPIXMAP pixmap = NULL, disabled = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6547 HPOINTER icon = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6548
1693
b2311922a4de Ah so... eliminated the last few VAC36 warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1692
diff changeset
6549 if((pixmap = calloc(1, sizeof(struct _hpixmap))) != NULL)
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6550 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6551 int z, j, lim;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6552 LONG fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6553 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6554 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6555 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6556 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6557 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6558 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6559 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6560 fclose( fp );
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
6561 if(!_load_bitmap_file( file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth));
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6562 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6563 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6564 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6565 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6566 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6567 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6568 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6569 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6570 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6571 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6572 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6573
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6574 if ( icon )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6575 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6576 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6577 pixmap = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6578 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6579 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6580 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6581 /* Create a disabled style pixmap */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6582 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
6583 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
6584
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6585 fore = _foreground;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6586 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
6587 lim = pixmap->width/2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6588 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
6589 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6590 int mod = j%2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6591
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6592 for(z=0;z<lim;z++)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6593 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
6594 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6595 _foreground = fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6596 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6597 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6598
1397
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6599 if(text)
2ccf7eacedf5 Safety checks in dw_bitmapbutton_new*() on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1395
diff changeset
6600 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
6601 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6602
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6603 WinSetWindowPtr(tmp, QWP_USER, blah);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6604
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6605 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6606 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
6607 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6608 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6609 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
6610 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
6611 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6612 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
6613 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
6614 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6615
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6616 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6617 * Create a new spinbutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6618 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6619 * 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
6620 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6621 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6622 HWND API dw_spinbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6623 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6624 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6625 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6626 WC_SPINBUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6627 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6628 WS_VISIBLE | SPBS_MASTER,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6629 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6630 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6631 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6632 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6633 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6634 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6635 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
6636 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
6637 WinSendMsg(tmp, SPBM_SETCURRENTVALUE, MPFROMLONG(atoi(text)), 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6638 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6639 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6640 blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6641 blah->oldproc = WinSubclassWindow(entry, _spinentryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6642 WinSetWindowPtr(entry, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6643 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6644 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
6645 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
6646 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6647 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6648
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6649 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6650 * Create a new radiobutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6651 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6652 * 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
6653 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6654 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6655 HWND API dw_radiobutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6656 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6657 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6658 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6659 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6660 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6661 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6662 BS_AUTORADIOBUTTON,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6663 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6664 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6665 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6666 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6667 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6668 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6669 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6670 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6671 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
6672 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
6673 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6674 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6675
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
6676
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6677 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6678 * 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
6679 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6680 * 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
6681 * 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
6682 * 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
6683 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6684 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
6685 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6686 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6687 SLDCDATA sldcData = { 0, 0, 0, 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6688 HWND tmp;
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 sldcData.cbSize = sizeof(SLDCDATA);
1394
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
6691 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
6692
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6693 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6694 WC_SLIDER,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6695 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6696 WS_VISIBLE | SLS_SNAPTOINCREMENT |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6697 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6698 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6699 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6700 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
6701 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6702 &sldcData,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6703 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6704
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6705 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6706 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6707 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
6708 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6709
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6710 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6711 * 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
6712 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6713 * 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
6714 * 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
6715 * 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
6716 */
511
80dbd5a1f403 Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 510
diff changeset
6717 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
6718 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6719 return WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6720 WC_SCROLLBAR,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6721 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6722 WS_VISIBLE | SBS_AUTOTRACK |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6723 (vertical ? SBS_VERT : SBS_HORZ),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6724 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6725 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6726 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
6727 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6728 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6729 NULL);
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6730 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6731
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6732 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
6733 * Create a new percent bar window (widget) to be packed.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6734 * 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
6735 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6736 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6737 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
6738 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6739 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6740 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6741 WC_SLIDER,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6742 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6743 WS_VISIBLE | SLS_READONLY
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6744 | SLS_RIBBONSTRIP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6745 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6746 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6747 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
6748 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6749 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6750 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6751 blah->oldproc = WinSubclassWindow(tmp, _percentproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6752 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6753 dw_window_disable(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6754 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6755 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6756
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6757 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6758 * Create a new checkbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6759 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6760 * 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
6761 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6762 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6763 HWND API dw_checkbox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6764 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6765 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6766 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6767 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6768 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6769 WS_VISIBLE | BS_AUTOCHECKBOX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6770 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6771 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6772 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6773 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6774 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6775 NULL);
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6776 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6777 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6778 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
6779 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
6780 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6781 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6782
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6783 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6784 * Create a new listbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6785 * 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
6786 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6787 * multi: Multiple select TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6788 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6789 HWND API dw_listbox_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6790 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6791 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6792 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6793 WC_LISTBOX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6794 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6795 WS_VISIBLE | LS_NOADJUSTPOS |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6796 (multi ? LS_MULTIPLESEL : 0),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6797 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6798 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6799 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
6800 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6801 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6802 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6803 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6804 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6805 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6806 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
6807 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6808 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6809
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6810 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6811 * Sets the icon used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6812 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6813 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6814 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6815 */
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
6816 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
6817 {
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
6818 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
6819 WinSendMsg(handle, WM_SETICON, (MPARAM)hptr, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6820 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6821
1733
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6822 /* GBM seems to be compiled with VisualAge which defines O_BINARY and O_RDONLY
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6823 * as follows... but other compilers (GCC and Watcom at least) define them
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6824 * differently... so we add defines that are compatible with VAC here.
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6825 */
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6826 #define GBM_O_BINARY 0x00008000
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6827 #define GBM_O_RDONLY 0x00000004
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6828
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6829 /* 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
6830 * 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
6831 */
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
6832 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height, int *depth)
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6833 {
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6834 PBITMAPINFOHEADER2 pBitmapInfoHeader;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6835 /* pointer to the first byte of bitmap data */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6836 PBYTE BitmapFileBegin, BitmapBits;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6837 ULONG ulFlags;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6838 SIZEL sizl = { 0 };
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6839 HPS hps1;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6840 HDC hdc1;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6841
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6842 /* If we have GBM support open the file using GBM */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6843 if(_gbm_init)
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6844 {
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6845 int fd, z, err = -1, ft = 0;
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6846 GBM gbm;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6847 GBMRGB *gbmrgb;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6848 ULONG byteswidth;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6849
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6850 /* Try to open the file */
1733
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6851 if((fd = _gbm_io_open(file, GBM_O_RDONLY|GBM_O_BINARY)) == -1)
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6852 {
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6853 #ifdef DEBUG
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6854 dw_debug("Failed to open file %s\n", file);
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6855 #endif
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6856 return 0;
1733
4314ee3dbeb1 Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1716
diff changeset
6857 }
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6858
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6859 /* guess the source file type from the source filename */
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6860 _gbm_query_n_filetypes(&ft);
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6861
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6862 for(z=0;z<ft;z++)
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6863 {
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6864 /* Read the file header */
1699
df7ca5c4fa5b Removed some code to workaround a buggy version of GBM on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1698
diff changeset
6865 if((err = _gbm_read_header(file, fd, z, &gbm, "")) == 0)
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6866 break;
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6867 }
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6868
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6869 /* If we failed to load the header */
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6870 if(err)
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6871 {
1699
df7ca5c4fa5b Removed some code to workaround a buggy version of GBM on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1698
diff changeset
6872 #ifdef DEBUG
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6873 dw_debug("GBM: Read header type %d \"%s\" %d %s\n", z, file, err, _gbm_err(err));
1699
df7ca5c4fa5b Removed some code to workaround a buggy version of GBM on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1698
diff changeset
6874 #endif
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6875 _gbm_io_close(fd);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6876 return 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6877 }
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6878
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6879 /* if less than 24-bit, then have palette */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6880 if(gbm.bpp < 24)
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6881 {
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6882 gbmrgb = alloca(sizeof(GBMRGB));
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6883 /* Read the palette from the file */
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6884 if((err = _gbm_read_palette(fd, z, &gbm, gbmrgb)) != 0)
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6885 {
1699
df7ca5c4fa5b Removed some code to workaround a buggy version of GBM on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1698
diff changeset
6886 #ifdef DEBUG
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6887 dw_debug("GBM: Read palette type %d \"%s\" %d %s\n", z, file, err, _gbm_err(err));
1699
df7ca5c4fa5b Removed some code to workaround a buggy version of GBM on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1698
diff changeset
6888 #endif
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6889 _gbm_io_close(fd);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6890 return 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6891 }
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6892 }
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6893 else
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6894 gbmrgb = NULL;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6895
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6896 /* Save the dimension for return */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6897 *width = gbm.w;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6898 *height = gbm.h;
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
6899 *depth = gbm.bpp;
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6900 byteswidth = (((gbm.w*gbm.bpp + 31)/32)*4);
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6901
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6902 /* Allocate a buffer to store the image */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6903 DosAllocMem((PPVOID)&BitmapFileBegin, (ULONG)byteswidth * gbm.h,
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6904 PAG_READ | PAG_WRITE | PAG_COMMIT);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6905
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6906 /* Read the data into our buffer */
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6907 if((err = _gbm_read_data(fd, z, &gbm, BitmapFileBegin)) != 0)
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6908 {
1699
df7ca5c4fa5b Removed some code to workaround a buggy version of GBM on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1698
diff changeset
6909 #ifdef DEBUG
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6910 dw_debug("GBM: Read data type %d \"%s\" %d %s\n", z, file, err, _gbm_err(err));
1699
df7ca5c4fa5b Removed some code to workaround a buggy version of GBM on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1698
diff changeset
6911 #endif
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6912 _gbm_io_close(fd);
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
6913 DosFreeMem(BitmapFileBegin);
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6914 return 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6915 }
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6916
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6917 /* Close the file */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6918 _gbm_io_close(fd);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6919
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6920 pBitmapInfoHeader = alloca(sizeof(BITMAPINFOHEADER2));
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6921 memset(pBitmapInfoHeader, 0, sizeof(BITMAPINFOHEADER2));
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6922 pBitmapInfoHeader->cbFix = sizeof(BITMAPINFOHEADER2);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6923 pBitmapInfoHeader->cx = (SHORT)gbm.w;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6924 pBitmapInfoHeader->cy = (SHORT)gbm.h;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6925 pBitmapInfoHeader->cPlanes = (SHORT)1;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6926 pBitmapInfoHeader->cBitCount = (SHORT)gbm.bpp;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6927
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6928 /* Put the bitmap bits into the destination */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6929 BitmapBits = BitmapFileBegin;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6930 }
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6931 else
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6932 {
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6933 HFILE BitmapFileHandle = NULLHANDLE; /* handle for the file */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6934 ULONG OpenAction = 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6935 FILESTATUS BitmapStatus;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6936 ULONG cbRead;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6937 PBITMAPFILEHEADER2 pBitmapFileHeader;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6938
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6939 /* open bitmap file */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6940 DosOpen((PSZ)file, &BitmapFileHandle, &OpenAction, 0L,
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6941 FILE_ARCHIVED | FILE_NORMAL | FILE_READONLY,
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6942 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6943 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY |
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6944 OPEN_FLAGS_NOINHERIT, 0L);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6945
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6946 if(!BitmapFileHandle)
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6947 return 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6948
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6949 /* find out how big the file is */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6950 DosQueryFileInfo(BitmapFileHandle, 1, &BitmapStatus,
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6951 sizeof(BitmapStatus));
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6952
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6953 /* allocate memory to load the bitmap */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6954 DosAllocMem((PPVOID)&BitmapFileBegin, (ULONG)BitmapStatus.cbFile,
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6955 PAG_READ | PAG_WRITE | PAG_COMMIT);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6956
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6957 /* read bitmap file into memory buffer */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6958 DosRead(BitmapFileHandle, (PVOID)BitmapFileBegin,
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6959 BitmapStatus.cbFile, &cbRead);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6960
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6961 /* access first bytes as bitmap header */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6962 pBitmapFileHeader = (PBITMAPFILEHEADER2)BitmapFileBegin;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6963
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6964 /* check if it's a valid bitmap data file */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6965 if((pBitmapFileHeader->usType != BFT_BITMAPARRAY) &&
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6966 (pBitmapFileHeader->usType != BFT_BMAP))
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6967 {
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6968 /* free memory of bitmap file buffer */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6969 DosFreeMem(BitmapFileBegin);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6970 /* close the bitmap file */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6971 DosClose(BitmapFileHandle);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6972 return 0;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6973 }
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6974
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6975 /* check if it's a file with multiple bitmaps */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6976 if(pBitmapFileHeader->usType == BFT_BITMAPARRAY)
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6977 {
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6978 /* we'll just use the first bitmap and ignore the others */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6979 pBitmapFileHeader = &(((PBITMAPARRAYFILEHEADER2)BitmapFileBegin)->bfh2);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6980 }
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6981
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6982 /* set pointer to bitmap information block */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6983 pBitmapInfoHeader = &pBitmapFileHeader->bmp2;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6984
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6985 /* find out if it's the new 2.0 format or the old format */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6986 /* and query number of lines */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6987 if(pBitmapInfoHeader->cbFix == sizeof(BITMAPINFOHEADER))
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6988 {
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6989 *height = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cy;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6990 *width = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cx;
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
6991 *depth = (int)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cBitCount;
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6992 }
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6993 else
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6994 {
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6995 *height = pBitmapInfoHeader->cy;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6996 *width = pBitmapInfoHeader->cx;
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
6997 *depth = pBitmapInfoHeader->cBitCount;
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6998 }
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
6999
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7000 /* Put the bitmap bits into the destination */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7001 BitmapBits = BitmapFileBegin + pBitmapFileHeader->offBits;
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7002
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7003 /* close the bitmap file */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7004 DosClose(BitmapFileHandle);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7005 }
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7006
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7007 /* now we need a presentation space, get it from static control */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7008 hps1 = WinGetPS(handle);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7009
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7010 hdc1 = GpiQueryDevice(hps1);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7011 ulFlags = GpiQueryPS(hps1, &sizl);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7012
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7013 *hdc = DevOpenDC(dwhab, OD_MEMORY, (PSZ)"*", 0L, NULL, hdc1);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7014 *hps = GpiCreatePS (dwhab, *hdc, &sizl, ulFlags | GPIA_ASSOC);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7015
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7016 /* create bitmap now using the parameters from the info block */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7017 *hbm = GpiCreateBitmap(*hps, pBitmapInfoHeader, 0L, NULL, NULL);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7018
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7019 /* select the new bitmap into presentation space */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7020 GpiSetBitmap(*hps, *hbm);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7021
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7022 /* now copy the bitmap data into the bitmap */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7023 GpiSetBitmapBits(*hps, 0L, *height,
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7024 BitmapBits,
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7025 (PBITMAPINFO2)pBitmapInfoHeader);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7026
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7027 WinReleasePS(hps1);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7028
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7029 /* free memory of bitmap file buffer */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7030 if(BitmapFileBegin)
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7031 DosFreeMem(BitmapFileBegin);
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
7032 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
7033 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
7034
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7035 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7036 * Sets the bitmap used for a given static window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7037 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7038 * 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
7039 * 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
7040 * (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
7041 * 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
7042 * 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
7043 * 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
7044 */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
7045 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7046 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7047 HBITMAP hbm;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7048 HPS hps;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7049
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7050 /* Destroy any old bitmap data */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7051 _free_bitmap(handle);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7052
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7053 /* 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
7054 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7055 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7056 hps = WinGetPS( handle );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7057 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
7058 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7059 else if ( filename )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7060 {
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
7061 HDC hdc = 0;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7062 unsigned long width, height;
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
7063 char *file = alloca(strlen(filename) + 6);
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
7064 int depth;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7065
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7066 if(!file)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7067 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7068
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7069 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7070
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7071 /* 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
7072 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7073 {
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
7074 int z;
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
7075
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
7076 /* Try with supported extensions */
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
7077 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++)
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
7078 {
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
7079 strcpy(file, filename);
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
7080 strcat(file, image_exts[z]);
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
7081 if(access(file, 04) == 0 &&
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
7082 _load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height, &depth))
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
7083 break;
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
7084 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7085 }
1711
e2c5715d057d Fix dw_window_set_bitmap() on OS/2 on files with extensions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1703
diff changeset
7086 else
e2c5715d057d Fix dw_window_set_bitmap() on OS/2 on files with extensions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1703
diff changeset
7087 _load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height, &depth);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7088
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
7089 if(!hdc)
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7090 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7091
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7092 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
7093 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
7094 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
7095 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
7096 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7097 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7098 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7099
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7100 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7101 WinReleasePS(hps);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7102 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
7103
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
7104 /* 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
7105 {
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
7106 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
7107
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
7108 /* 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
7109 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
7110 {
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
7111 _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
7112 /* 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
7113 _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
7114 }
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
7115 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7116 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7117
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7118 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7119 * 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
7120 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7121 * handle: Handle to the window.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7122 * 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
7123 * (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
7124 * 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
7125 * 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
7126 * 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
7127 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7128 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
7129 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7130 HBITMAP hbm;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7131 HPS hps;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7132 HDC hdc;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7133 unsigned long width, height;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7134 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7135 FILE *fp;
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
7136 int depth;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7137
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7138 /* Destroy any old bitmap data */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7139 _free_bitmap(handle);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7140
1716
b39c137cc6f5 Only use the ID on OS/2 in dw_window_set_bitmap_from_file() if
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1711
diff changeset
7141 if ( data )
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7142 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7143 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7144 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7145 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7146 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7147 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7148 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7149 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7150 fclose( fp );
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
7151 if(!_load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height, &depth))
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7152 {
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
7153 /* can't use ICO ? */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7154 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7155 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7156 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7157 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7158 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7159 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7160 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7161 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7162 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7163 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7164 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7165
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7166 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
7167 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
7168 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
7169 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
7170 }
1716
b39c137cc6f5 Only use the ID on OS/2 in dw_window_set_bitmap_from_file() if
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1711
diff changeset
7171 /* If id is non-zero use the resource */
b39c137cc6f5 Only use the ID on OS/2 in dw_window_set_bitmap_from_file() if
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1711
diff changeset
7172 else if ( id )
b39c137cc6f5 Only use the ID on OS/2 in dw_window_set_bitmap_from_file() if
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1711
diff changeset
7173 {
b39c137cc6f5 Only use the ID on OS/2 in dw_window_set_bitmap_from_file() if
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1711
diff changeset
7174 hps = WinGetPS( handle );
b39c137cc6f5 Only use the ID on OS/2 in dw_window_set_bitmap_from_file() if
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1711
diff changeset
7175 hbm = GpiLoadBitmap( hps, NULLHANDLE, id, 0, 0 );
b39c137cc6f5 Only use the ID on OS/2 in dw_window_set_bitmap_from_file() if
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1711
diff changeset
7176 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7177 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7178 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7179
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7180 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7181 WinReleasePS(hps);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7182 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7183 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7184
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7185 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7186 * Sets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7187 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7188 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7189 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7190 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7191 void API dw_window_set_text(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7192 {
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
7193 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
7194 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
7195 /* 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
7196 {
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
7197 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
7198
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
7199 /* 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
7200 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
7201 {
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
7202 _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
7203 /* 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
7204 _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
7205 }
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
7206 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7207 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7208
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7209 /*
1389
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
7210 * 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
7211 * Parameters:
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
7212 * 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
7213 * 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
7214 */
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
7215 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
7216 {
1398
152e3c8916de Set tooltip on the entryfield part of a combobox...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1397
diff changeset
7217 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
7218 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
7219 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
7220
152e3c8916de Set tooltip on the entryfield part of a combobox...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1397
diff changeset
7221 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
7222
a151d45a7041 Added generic tooltip support on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1393
diff changeset
7223 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
7224 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
7225 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
7226 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
7227 }
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
7228
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
7229 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7230 * Gets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7231 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7232 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7233 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7234 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7235 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7236 char * API dw_window_get_text(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7237 {
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
7238 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
7239 int len = WinQueryWindowTextLength(entryfield ? entryfield : handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7240 char *tempbuf = calloc(1, len + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7241
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7242 WinQueryWindowText(entryfield ? entryfield : handle, len + 1, (PSZ)tempbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7243
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7244 return tempbuf;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7245 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7246
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7247 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7248 * Disables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7249 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7250 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7251 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7252 void API dw_window_disable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7253 {
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
7254 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7255
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
7256 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
7257 {
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
7258 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
7259 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
7260
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
7261 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
7262 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
7263
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
7264 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
7265 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
7266 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
7267 }
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
7268
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7269 if(dw_window_get_data(handle, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7270 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7271
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7272 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7273 dw_window_set_data(handle, "_dw_disabled", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7274
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7275 if(tmpbuf[0] == '#')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7276 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7277 int val = atoi(&tmpbuf[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7278 HWND hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7279
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7280 switch(val)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7281 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7282 case 2:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7283 case 6:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7284 case 10:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7285 case 32:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7286 case 7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7287 hwnd = _find_entryfield(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7288 _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
7289 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
7290 if(val == 2)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7291 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
7292 if(hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7293 dw_window_set_data(hwnd, "_dw_disabled", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7294 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7295 case 3:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7296 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
7297 WinEnableWindow(handle, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7298 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
7299 WinInvalidateRect(handle, NULL, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7300 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7301 _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
7302 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
7303 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
7304 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7305 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7306 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7307 WinEnableWindow(handle, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7308 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7309
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7310 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7311 * Enables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7312 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7313 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7314 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7315 void API dw_window_enable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7316 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7317 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
7318 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
7319 HWND hwnd = _find_entryfield(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7320
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
7321 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
7322 {
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
7323 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
7324 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
7325
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
7326 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
7327 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
7328
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
7329 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
7330 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
7331 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
7332 }
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
7333
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7334 dw_window_set_data(handle, "_dw_disabled", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7335 if(hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7336 dw_window_set_data(hwnd, "_dw_disabled", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7337 if(fore && back)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7338 _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
7339 dw_signal_disconnect_by_data(handle, (void *)100);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7340 WinEnableWindow(handle, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7341 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
7342 WinInvalidateRect(handle, NULL, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7343 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7344
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7345 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7346 * Gets the child window handle with specified ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7347 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7348 * handle: Handle to the parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7349 * id: Integer ID of the child.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7350 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7351 HWND API dw_window_from_id(HWND handle, int id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7352 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7353 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7354 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
7355 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7356
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7357 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7358 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7359 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7360 int windowid = WinQueryWindowUShort(child, QWS_ID);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7361 HWND found;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7362
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7363 WinQueryClassName(child, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7364
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7365 /* 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
7366 if(strncmp(tmpbuf, "#1", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7367 if((found = dw_window_from_id(child, id)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7368 return found;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7369
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7370 if(windowid && windowid == id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7371 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7372 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7373 return child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7374 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7375 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7376 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7377 return NULLHANDLE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7378 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7379
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
7380 /* 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
7381 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
7382 {
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
7383 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
7384
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7385 /*
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7386 * 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
7387 * 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
7388 */
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7389 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
7390 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7391 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
7392 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
7393 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7394
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7395 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
7396 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7397 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
7398 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
7399 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7400 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
7401 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7402 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
7403 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7404 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
7405 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7406 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7407
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7408 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
7409
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7410 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
7411 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7412 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
7413 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
7414 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
7415 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
7416
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7417 /* 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
7418 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
7419 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
7420 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
7421 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
7422
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7423 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
7424
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7425 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
7426 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7427 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
7428 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
7429 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
7430 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
7431 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7432
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7433
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7434 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
7435
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7436 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
7437 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
7438 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
7439 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
7440
1645
69386c5a8e3e Fixed render widgets being incorrectly identified as boxes on OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1642
diff changeset
7441 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
7442 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
7443 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
7444 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7445 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
7446 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
7447 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
7448 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
7449
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7450 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
7451 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7452
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7453 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
7454 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
7455 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
7456 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
7457 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
7458 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
7459
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
7460 /* 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
7461 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
7462 _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
7463
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7464 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
7465
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7466 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
7467 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
7468
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7469 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
7470
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7471 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
7472 /* 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
7473 * 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
7474 * 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
7475 */
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
7476 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
7477 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
7478 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
7479 _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
7480 /* Queue a redraw on the top-level window */
1673
db393069b27d Fix packing padding not triggering automatic redraws on OS/2, Mac and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1670
diff changeset
7481 _dw_redraw(_toplevel_window(box), 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
7482 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7483 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7484
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
7485 /*
1667
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7486 * Remove windows (widgets) from the box they are packed into.
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7487 * Parameters:
1679
e19b93a8229b More comment cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1678
diff changeset
7488 * handle: Window handle of the packed item to be removed.
1667
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7489 * Returns:
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7490 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure.
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7491 */
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7492 int API dw_box_remove(HWND handle)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7493 {
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7494 HWND parent = WinQueryWindow(handle, QW_PARENT);
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7495
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7496 if(parent != desktop)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7497 {
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7498 Box *thisbox = WinQueryWindowPtr(parent, QWP_USER);
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7499
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7500 /* If the parent box has items...
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7501 * try to remove it from the layout
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7502 */
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7503 if(thisbox && thisbox->count)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7504 {
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7505 int z, index = -1;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7506 Item *tmpitem, *thisitem = thisbox->items;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7507
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7508 for(z=0;z<thisbox->count;z++)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7509 {
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7510 if(thisitem[z].hwnd == handle)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7511 index = z;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7512 }
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7513
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7514 if(index == -1)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7515 return DW_ERROR_GENERAL;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7516
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7517 tmpitem = malloc(sizeof(Item)*(thisbox->count-1));
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7518
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7519 /* Copy all but the current entry to the new list */
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7520 for(z=0;z<index;z++)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7521 {
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7522 tmpitem[z] = thisitem[z];
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7523 }
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7524 for(z=index+1;z<thisbox->count;z++)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7525 {
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7526 tmpitem[z-1] = thisitem[z];
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7527 }
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7528
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7529 thisbox->items = tmpitem;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7530 free(thisitem);
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7531 thisbox->count--;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7532 /* If it isn't padding, reset the parent */
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7533 if(handle)
1668
724a7361cb42 Missing parameter to WinSetParent() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1667
diff changeset
7534 WinSetParent(handle, HWND_OBJECT, FALSE);
1667
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7535 /* Queue a redraw on the top-level window */
1680
b09f5f73189c On OS/2 and Windows need to use the parent (box) handle not the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1679
diff changeset
7536 _dw_redraw(_toplevel_window(parent), TRUE);
1667
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7537 return DW_ERROR_NONE;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7538 }
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7539 }
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7540 return DW_ERROR_GENERAL;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7541 }
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7542
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7543 /*
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7544 * Remove windows (widgets) from a box at an arbitrary location.
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7545 * Parameters:
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7546 * box: Window handle of the box to be removed from.
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7547 * index: 0 based index of packed items.
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7548 * Returns:
1679
e19b93a8229b More comment cleanups.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1678
diff changeset
7549 * Handle to the removed item on success, 0 on failure or padding.
1667
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7550 */
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7551 HWND API dw_box_remove_at_index(HWND box, int index)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7552 {
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7553 Box *thisbox = WinQueryWindowPtr(box, QWP_USER);
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7554
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7555 /* Try to remove it from the layout */
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7556 if(thisbox && index > -1 && index < thisbox->count)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7557 {
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7558 int z;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7559 Item *tmpitem, *thisitem = thisbox->items;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7560 HWND handle = thisitem[index].hwnd;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7561
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7562 tmpitem = malloc(sizeof(Item)*(thisbox->count-1));
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7563
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7564 /* Copy all but the current entry to the new list */
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7565 for(z=0;z<index;z++)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7566 {
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7567 tmpitem[z] = thisitem[z];
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7568 }
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7569 for(z=index+1;z<thisbox->count;z++)
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7570 {
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7571 tmpitem[z-1] = thisitem[z];
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7572 }
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7573
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7574 thisbox->items = tmpitem;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7575 free(thisitem);
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7576 thisbox->count--;
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7577 /* If it isn't padding, reset the parent */
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7578 if(handle)
1668
724a7361cb42 Missing parameter to WinSetParent() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1667
diff changeset
7579 WinSetParent(handle, HWND_OBJECT, FALSE);
1667
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7580 /* Queue a redraw on the top-level window */
1669
36a090da4cb1 Initial implementation of dw_box_remove() for GTK2/3 and stub for dw_box_remove_at_index().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1668
diff changeset
7581 _dw_redraw(_toplevel_window(box), TRUE);
36a090da4cb1 Initial implementation of dw_box_remove() for GTK2/3 and stub for dw_box_remove_at_index().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1668
diff changeset
7582 return handle;
36a090da4cb1 Initial implementation of dw_box_remove() for GTK2/3 and stub for dw_box_remove_at_index().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1668
diff changeset
7583 }
36a090da4cb1 Initial implementation of dw_box_remove() for GTK2/3 and stub for dw_box_remove_at_index().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1668
diff changeset
7584 return 0;
1667
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7585 }
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7586
9dbd2984c1e5 Initial implementation of dw_box_remove() and dw_box_remove_at_index()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1661
diff changeset
7587 /*
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
7588 * 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
7589 * 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
7590 * box: Window handle of the box to be packed into.
1678
896f377a47c7 Added exports for building with MinGW on Windows and Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1676
diff changeset
7591 * item: Window handle of the item to pack.
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
7592 * 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
7593 * 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
7594 * 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
7595 * 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
7596 * 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
7597 * 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
7598 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7599 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
7600 {
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7601 _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
7602 }
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7603
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7604 /*
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7605 * 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
7606 * 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
7607 * box: Window handle of the box to be packed into.
1678
896f377a47c7 Added exports for building with MinGW on Windows and Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1676
diff changeset
7608 * item: Window handle of the item to pack.
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
7609 * 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
7610 * 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
7611 * 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
7612 * 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
7613 * 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
7614 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7615 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
7616 {
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7617 /* 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
7618 * 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
7619 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7620 _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
7621 }
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7622
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
7623 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7624 * Pack windows (widgets) into a box from the end (or bottom).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7625 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7626 * box: Window handle of the box to be packed into.
1678
896f377a47c7 Added exports for building with MinGW on Windows and Watcom on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1676
diff changeset
7627 * item: Window handle of the item to pack.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7628 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7629 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7630 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7631 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7632 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7633 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7634 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
7635 {
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
7636 _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
7637 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7638
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7639 /*
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
7640 * 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
7641 * 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
7642 */
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7643 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
7644 {
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7645 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
7646 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
7647
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7648 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
7649 {
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7650 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
7651 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
7652
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7653 /* 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
7654 _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
7655
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7656 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
7657 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
7658
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7659 /* 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
7660 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
7661
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7662 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
7663 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
7664 }
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7665 }
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7666
914ac25f7d37 Fix auto-sizing top-level windows with menus on OS/2 using WinCalcFrameRect().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1442
diff changeset
7667 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7668 * Sets the size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7669 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7670 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7671 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7672 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7673 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7674 void API dw_window_set_size(HWND handle, ULONG width, ULONG height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7675 {
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
7676 /* 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
7677 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
7678 _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
7679
bde7ebced556 Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1436
diff changeset
7680 /* 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
7681 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SIZE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7682 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7683
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7684 /*
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
7685 * 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
7686 * 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
7687 * 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
7688 * 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
7689 * 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
7690 */
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
7691 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
7692 {
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
7693 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
7694
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
7695 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
7696
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
7697 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
7698 {
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
7699 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
7700
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
7701 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
7702 {
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
7703 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
7704
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
7705 /* 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
7706 _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
7707
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
7708 /* 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
7709 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
7710 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
7711 }
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
7712 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
7713 {
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
7714 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
7715
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
7716 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
7717 {
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
7718 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
7719
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
7720 /* 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
7721 _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
7722
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
7723 /* 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
7724 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
7725 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
7726 }
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
7727 }
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
7728 }
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
7729 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
7730 _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
7731 }
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
7732
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
7733 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7734 * Returns the width of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7735 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7736 int API dw_screen_width(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7737 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7738 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7739 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7740
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7741 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7742 * Returns the height of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7743 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7744 int API dw_screen_height(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7745 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7746 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN);
3
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 /* 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
7750 unsigned long API dw_color_depth_get(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7751 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7752 HDC hdc = WinOpenWindowDC(HWND_DESKTOP);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7753 long colors;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7754
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7755 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7756 DevCloseDC(hdc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7757 return colors;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7758 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7759
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
7760 /*
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
7761 * 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
7762 * 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
7763 * 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
7764 * 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
7765 * 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
7766 * 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
7767 */
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
7768 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
7769 {
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
7770 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
7771 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
7772 }
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
7773
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7774 /* 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
7775 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
7776 {
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7777 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
7778 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
7779
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7780 /* 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
7781 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
7782 {
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7783 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
7784
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7785 /* 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
7786 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
7787 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
7788 /* 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
7789 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
7790 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
7791 /* 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
7792 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
7793 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
7794 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
7795 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
7796
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7797 /* 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
7798 *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
7799 *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
7800 }
1495
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7801 /* 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
7802 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
7803 {
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7804 RECTL rect;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7805
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7806 _WinQueryDesktopWorkArea(HWND_DESKTOP, &rect);
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7807
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7808 if(horz & DW_GRAV_OBSTACLES)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7809 {
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7810 if((horz & 0xf) == DW_GRAV_LEFT)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7811 *x += rect.xLeft;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7812 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
7813 *x -= dw_screen_width() - rect.xRight;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7814 }
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7815 if(vert & DW_GRAV_OBSTACLES)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7816 {
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7817 if((vert & 0xf) == DW_GRAV_BOTTOM)
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7818 *y += rect.yBottom;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7819 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
7820 *y -= dw_screen_height() - rect.yTop;
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7821 }
3b4dc98d753b Initial gravity obstacles support for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1488
diff changeset
7822 }
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7823 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7824
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7825 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7826 * Sets the position of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7827 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7828 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7829 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7830 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7831 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7832 void API dw_window_set_pos(HWND handle, LONG x, LONG y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7833 {
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7834 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
7835
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7836 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
7837 /* 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
7838 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
7839 {
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
7840 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
7841 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
7842 }
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7843 _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
7844 WinSetWindowPos(handle, NULLHANDLE, x, y, 0, 0, SWP_MOVE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7845 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7846
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7847 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7848 * Sets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7849 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7850 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7851 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7852 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7853 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7854 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7855 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7856 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
7857 {
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
7858 /* 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
7859 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
7860 _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
7861
1472
1794caee0758 Initial versions of dw_window_set_gravity for Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1466
diff changeset
7862 _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
7863 /* 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
7864 WinSetWindowPos(handle, NULLHANDLE, x, y, width, height, SWP_MOVE | SWP_SIZE);
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 * Gets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7869 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7870 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7871 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7872 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7873 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7874 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7875 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7876 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
7877 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7878 SWP swp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7879 WinQueryWindowPos(handle, &swp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7880 if(x)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7881 *x = swp.x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7882 if(y)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7883 *y = _get_frame_height(handle) - (swp.y + swp.cy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7884 if(width)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7885 *width = swp.cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7886 if(height)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7887 *height = swp.cy;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7888 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7889
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7890 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7891 * Sets the style of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7892 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7893 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7894 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7895 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7896 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7897 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7898 {
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
7899 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
7900 {
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7901 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
7902 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
7903
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7904 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
7905 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
7906
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7907 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
7908 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
7909 }
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
7910 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
7911 WinSetWindowBits(handle, QWL_STYLE, style, mask);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7912 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7913
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7914 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7915 * Adds a new page to specified notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7916 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7917 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7918 * flags: Any additional page creation flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7919 * front: If TRUE page is added at the beginning.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7920 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7921 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7922 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7923 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7924 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), front ? BKA_FIRST : BKA_LAST));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7925 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7926
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7927 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7928 * Remove a page from a notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7929 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7930 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7931 * pageid: ID of the page to be destroyed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7932 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7933 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7934 {
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
7935 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
7936 MPFROMLONG(pageid), 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7937 WinSendMsg(handle, BKM_DELETEPAGE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7938 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
7939 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
7940 dw_window_destroy(pagehwnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7941 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7942
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7943 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7944 * Queries the currently visible page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7945 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7946 * handle: Handle to the notebook widget.
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 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
7949 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7950 return (unsigned long)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR));
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 * Sets the currently visibale page ID.
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 notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7957 * pageid: ID of the page to be made visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7958 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7959 void API dw_notebook_page_set(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7960 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7961 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7962 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7963
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7964 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7965 * Sets the text on the specified notebook tab.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7966 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7967 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7968 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7969 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7970 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7971 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7972 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7973 WinSendMsg(handle, BKM_SETTABTEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7974 MPFROMLONG(pageid), MPFROMP(text));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7975 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7976
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7977 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7978 * Sets the text on the specified notebook tab status area.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7979 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7980 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7981 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7982 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7983 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7984 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7985 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7986 WinSendMsg(handle, BKM_SETSTATUSLINETEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7987 MPFROMLONG(pageid), MPFROMP(text));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7988 }
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 * Packs the specified box into the notebook page.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7992 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7993 * handle: Handle to the notebook to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7994 * pageid: Page ID in the notebook which is being packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7995 * page: Box handle to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7996 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7997 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7998 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7999 HWND tmpbox = dw_box_new(DW_VERT, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8000
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8001 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
8002 WinSubclassWindow(tmpbox, _wndproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8003 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8004 MPFROMLONG(pageid), MPFROMHWND(tmpbox));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8005 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8006
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8007 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8008 * Appends the specified text to the listbox's (or combobox) entry list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8009 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8010 * handle: Handle to the listbox to be appended to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8011 * text: Text to append into listbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8012 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8013 void API dw_listbox_append(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8014 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8015 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8016 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8017 MPFROMSHORT(LIT_END),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8018 MPFROMP(text));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8019 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8020
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8021 /*
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8022 * 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
8023 * Parameters:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8024 * handle: Handle to the listbox to be inserted into.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8025 * text: Text to insert into listbox.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8026 * pos: 0-based position to insert text
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8027 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8028 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
8029 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8030 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8031 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8032 MPFROMSHORT(pos),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8033 MPFROMP(text));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8034 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8035
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8036 /*
571
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
8037 * 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
8038 * Parameters:
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
8039 * 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
8040 * text: Text strings to append into listbox.
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
8041 * count: Number of text strings to append
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
8042 */
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
8043 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
8044 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8045 int i;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8046 for(i=0;i<count;i++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8047 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8048 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8049 MPFROMSHORT(LIT_END),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8050 MPFROMP(text[i]));
571
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
8051 }
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
8052
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
8053 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8054 * Clears the listbox's (or combobox) list of all entries.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8055 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8056 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8057 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8058 void API dw_listbox_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8059 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8060 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8061 LM_DELETEALL, 0L, 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8062 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8063
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8064 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8065 * Returns the listbox's item count.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8066 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8067 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8068 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8069 int API dw_listbox_count(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8070 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8071 return (int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8072 LM_QUERYITEMCOUNT,0L, 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8073 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8074
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8075 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8076 * Sets the topmost item in the viewport.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8077 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8078 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8079 * top: Index to the top item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8080 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8081 void API dw_listbox_set_top(HWND handle, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8082 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8083 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8084 LM_SETTOPINDEX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8085 MPFROMSHORT(top),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8086 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8087 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8088
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8089 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8090 * Copies the given index item's text into buffer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8091 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8092 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8093 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8094 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8095 * length: Length of the buffer (including NULL).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8096 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8097 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
8098 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8099 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8100 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8101
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8102 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8103 * Sets the text of a given listbox entry.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8104 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8105 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8106 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8107 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8108 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8109 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8110 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8111 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8112 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8113
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8114 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8115 * Returns the index to the item in the list currently selected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8116 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8117 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8118 */
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
8119 int API dw_listbox_selected(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8120 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8121 return (unsigned int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8122 LM_QUERYSELECTION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8123 MPFROMSHORT(LIT_CURSOR),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8124 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8125 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8126
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8127 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8128 * Returns the index to the current selected item or -1 when done.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8129 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8130 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8131 * where: Either the previous return or -1 to restart.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8132 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8133 int API dw_listbox_selected_multi(HWND handle, int where)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8134 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8135 int place = where;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8136
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8137 if(where == -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8138 place = LIT_FIRST;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8139
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8140 place = (int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8141 LM_QUERYSELECTION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8142 MPFROMSHORT(place),0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8143 if(place == LIT_NONE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8144 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8145 return place;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8146 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8147
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8148 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8149 * Sets the selection state of a given index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8150 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8151 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8152 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8153 * state: TRUE if selected FALSE if unselected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8154 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8155 void API dw_listbox_select(HWND handle, int index, int state)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8156 {
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
8157 char tmpbuf[100] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8158
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8159 WinSendMsg(handle, LM_SELECTITEM, MPFROMSHORT(index), (MPARAM)state);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8160
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8161 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8162
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8163 /* 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
8164 if(strncmp(tmpbuf, "#6", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8165 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle);
3
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 * Deletes the item with given index from the list.
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 listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8172 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8173 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8174 void API dw_listbox_delete(HWND handle, int index)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8175 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8176 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8177 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8178
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8179 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8180 * Adds text to an MLE box and returns the current point.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8181 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8182 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8183 * buffer: Text buffer to be imported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8184 * startpoint: Point to start entering text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8185 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8186 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8187 {
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
8188 long point = startpoint < 0 ? 0 : startpoint;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8189 PBYTE mlebuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8190
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8191 /* Work around 64K limit */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8192 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
8193 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8194 int amount, len = strlen(buffer), written = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8195
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8196 while(written < len)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8197 {
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
8198 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
8199
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8200 if((len - written) > 65535)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8201 amount = 65535;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8202 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8203 amount = len - written;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8204
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
8205 /* 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
8206 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
8207 {
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
8208 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
8209 {
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
8210 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
8211 x++;
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
8212 }
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
8213 }
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
8214
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
8215 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
8216 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
8217 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
8218 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(x));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8219
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8220 written += amount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8221 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8222 DosFreeMem(mlebuf);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8223 }
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
8224 return point;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8225 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8226
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8227 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8228 * Grabs text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8229 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8230 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8231 * buffer: Text buffer to be exported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8232 * startpoint: Point to start grabbing text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8233 * length: Amount of text to be grabbed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8234 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8235 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8236 {
1000
99907f19a703 Minor fixed and code cleanups on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 996
diff changeset
8237 PBYTE mlebuf;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8238
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8239 /* Work around 64K limit */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8240 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
8241 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8242 int amount, copied, written = 0;
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 while(written < length)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8245 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8246 if((length - written) > 65535)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8247 amount = 65535;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8248 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8249 amount = length - written;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8250
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8251 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8252 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
8253
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8254 if(copied)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8255 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8256 memcpy(&buffer[written], mlebuf, copied);
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 written += copied;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8259 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8260 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8261 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8262 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8263 DosFreeMem(mlebuf);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8264 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8265 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8266
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8267 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8268 * Obtains information about an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8269 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8270 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8271 * bytes: A pointer to a variable to return the total bytes.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8272 * lines: A pointer to a variable to return the number of lines.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8273 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8274 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8275 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8276 if(bytes)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8277 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8278 if(lines)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8279 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8280 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8281
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8282 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8283 * Deletes text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8284 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8285 * handle: Handle to the MLE to be deleted from.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8286 * startpoint: Point to start deleting text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8287 * length: Amount of text to be deleted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8288 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8289 void API dw_mle_delete(HWND handle, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8290 {
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
8291 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(length));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8292 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8293
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8294 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8295 * Clears all text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8296 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8297 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8298 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8299 void API dw_mle_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8300 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8301 unsigned long bytes;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8302
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8303 dw_mle_get_size(handle, &bytes, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8304
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8305 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8306 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8307
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8308 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8309 * Sets the visible line of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8310 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8311 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8312 * line: Line to be visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8313 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
8314 void API dw_mle_set_visible(HWND handle, int line)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8315 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8316 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
8317 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(tmppnt), MPFROMLONG(tmppnt));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8318 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8319
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8320 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8321 * Sets the editablity of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8322 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8323 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8324 * 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
8325 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
8326 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
8327 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8328 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
8329 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8330
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8331 /*
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8332 * Sets the word wrap state of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8333 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8334 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8335 * 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
8336 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
8337 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
8338 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8339 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8340 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8341
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
8342 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8343 * Sets the current cursor position of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8344 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8345 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8346 * point: Point to position cursor.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8347 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8348 void API dw_mle_set_cursor(HWND handle, int point)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8349 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8350 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8351 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8352
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8353 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8354 * Finds text in an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8355 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8356 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8357 * text: Text to search for.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8358 * point: Start point of search.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8359 * flags: Search specific flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8360 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8361 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8362 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8363 MLE_SEARCHDATA msd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8364
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8365 /* 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
8366 * 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
8367 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8368 msd.cb = sizeof(msd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8369 msd.pchFind = text;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8370 msd.pchReplace = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8371 msd.cchFind = strlen(text);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8372 msd.cchReplace = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8373 msd.iptStart = point;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8374 msd.iptStop = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8375
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8376 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
8377 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
8378 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8379 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8380
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8381 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8382 * Stops redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8383 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8384 * handle: Handle to the MLE to freeze.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8385 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8386 void API dw_mle_freeze(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8387 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8388 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8389 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8390
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8391 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8392 * Resumes redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8393 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8394 * handle: Handle to the MLE to thaw.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8395 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8396 void API dw_mle_thaw(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8397 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8398 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8399 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8400
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8401 /* 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
8402 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
8403 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8404 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
8405
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8406 if(range)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8407 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8408 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
8409
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8410 if(mypos >= range)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8411 mypos = range - 1;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8412
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8413 _dw_int_set(handle, mypos);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8414 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
8415 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8416 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8417
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8418 /* 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
8419 void _percentthread(void *data)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8420 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8421 HWND percent = (HWND)data;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8422
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8423 if(percent)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8424 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8425 HAB thishab = WinInitialize(0);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8426 HMQ thishmq = WinCreateMsgQueue(dwhab, 0);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8427
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8428 int pos = 100;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8429
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8430 do
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8431 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8432 pos--;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8433 if(pos < 1)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8434 pos = 100;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8435 _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
8436 DosSleep(100);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8437 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8438 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
8439
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8440 WinDestroyMsgQueue(thishmq);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8441 WinTerminate(thishab);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8442 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8443 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8444
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8445 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
8446 * Sets the percent bar position.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8447 * 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
8448 * 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
8449 * position: Position of the percent bar withing the range.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8450 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8451 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
8452 {
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
8453 /* 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
8454 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
8455 {
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8456 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
8457 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8458 /* 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
8459 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
8460 _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
8461 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8462 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8463 else
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8464 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
8465 /* 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
8466 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
8467 /* 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
8468 _dw_percent_set_pos(handle, position);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8469 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8470 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8471
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8472 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8473 * 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
8474 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8475 * 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
8476 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8477 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
8478 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8479 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
8480 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8481
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8482 /*
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8483 * 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
8484 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8485 * 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
8486 * 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
8487 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8488 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
8489 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8490 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
8491 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
8492 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8493
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8494 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8495 * 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
8496 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8497 * 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
8498 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8499 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
8500 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8501 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
8502 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8503
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8504 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8505 * 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
8506 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8507 * 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
8508 * 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
8509 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8510 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
8511 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8512 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
8513 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
8514 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8515
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8516 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8517 * 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
8518 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8519 * 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
8520 * 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
8521 * 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
8522 */
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
8523 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
8524 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8525 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
8526 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
8527 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
8528 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
8529 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8530
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8531 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8532 * Sets the spinbutton value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8533 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8534 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8535 * position: Current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8536 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8537 void API dw_spinbutton_set_pos(HWND handle, long position)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8538 {
1625
50856987e794 Fixed value changed events on spinbuttons for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1592
diff changeset
8539 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
8540 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
8541 dw_window_set_data(handle, "_dw_updating", NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8542 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8543
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8544 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8545 * Sets the spinbutton limits.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8546 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8547 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8548 * upper: Upper limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8549 * lower: Lower limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8550 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8551 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8552 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8553 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8554 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8555
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8556 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8557 * Sets the entryfield character limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8558 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8559 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8560 * limit: Number of characters the entryfield will take.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8561 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8562 void API dw_entryfield_set_limit(HWND handle, ULONG limit)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8563 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8564 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8565 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8566
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8567
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8568 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8569 * Returns the current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8570 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8571 * handle: Handle to the spinbutton to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8572 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8573 long API dw_spinbutton_get_pos(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8574 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8575 long tmpval = 0L;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8576
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8577 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
8578 return tmpval;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8579 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8580
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8581 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8582 * Returns the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8583 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8584 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8585 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8586 int API dw_checkbox_get(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8587 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8588 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8589 }
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 * Sets the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8593 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8594 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8595 * value: TRUE for checked, FALSE for unchecked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8596 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8597 void API dw_checkbox_set(HWND handle, int value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8598 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8599 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8600 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8601
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8602 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8603 * 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
8604 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8605 * 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
8606 * 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
8607 * 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
8608 * 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
8609 * 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
8610 * 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
8611 */
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
8612 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
8613 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8614 ULONG cbExtra;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8615 PCNRITEM pci;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8616 RECORDINSERT ri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8617
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8618 if(!item)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8619 item = (HTREEITEM)CMA_FIRST;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8620
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8621 /* 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
8622 * MINIRECORDCORE structure
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8623 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8624
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8625 cbExtra = sizeof(CNRITEM) - sizeof(MINIRECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8626
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8627 /* Allocate memory for the parent record */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8628
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8629 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
8630 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8631
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8632 /* Fill in the parent record data */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8633
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8634 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
8635 pci->rc.pszIcon = (PSZ)strdup(title);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8636 pci->rc.hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8637
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8638 pci->hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8639 pci->user = itemdata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8640 pci->parent = parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8641
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8642 memset(&ri, 0, sizeof(RECORDINSERT));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8644 ri.cb = sizeof(RECORDINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8645 ri.pRecordOrder = (PRECORDCORE)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8646 ri.zOrder = (USHORT)CMA_TOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8647 ri.cRecordsInsert = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8648 ri.fInvalidateRecord = TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8649
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8650 /* 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
8651 * the one we just inserted.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8652 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8653 ri.pRecordParent = (PRECORDCORE)parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8654
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8655 /* Insert the record */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8656 WinSendMsg(handle, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8657
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8658 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
8659 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8660
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8661 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8662 * 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
8663 * Parameters:
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8664 * 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
8665 * title: The text title of the entry.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8666 * icon: Handle to coresponding icon.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8667 * parent: Parent handle or 0 if root.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8668 * itemdata: Item specific data.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8669 */
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
8670 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
8671 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8672 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
8673 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8674
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
8675 /*
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
8676 * 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
8677 * 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
8678 * 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
8679 * 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
8680 * 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
8681 * 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
8682 */
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
8683 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
8684 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8685 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8686
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8687 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8688 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8689
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8690 if(pci->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8691 free(pci->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8692
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8693 pci->rc.pszIcon = (PSZ)strdup(title);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8694 pci->rc.hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8695
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8696 pci->hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8697
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8698 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
8699 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8700
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8701 /*
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
8702 * 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
8703 * 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
8704 * 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
8705 * 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
8706 */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8707 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
8708 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8709 PCNRITEM pci = (PCNRITEM)item;
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 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8712 if(pci)
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8713 return (char *)pci->rc.pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8714 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
8715 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8716
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8717 /*
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8718 * 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
8719 * 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
8720 * 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
8721 * 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
8722 */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8723 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
8724 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8725 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8726
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8727 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8728 if(pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8729 return pci->parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8730 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
8731 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8732
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8733 /*
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
8734 * 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
8735 * 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
8736 * 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
8737 * 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
8738 * 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
8739 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
8740 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
8741 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8742 PCNRITEM pci = (PCNRITEM)item;
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 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8745 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8746 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8747
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8748 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
8749 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8750
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8751 /*
317
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8752 * 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
8753 * Parameters:
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8754 * 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
8755 * 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
8756 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8757 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
8758 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8759 PCNRITEM pci = (PCNRITEM)item;
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 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8762 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8763 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8764 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
8765 }
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8766
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
8767 /*
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
8768 * 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
8769 * 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
8770 * 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
8771 * 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
8772 */
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
8773 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
8774 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8775 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
8776
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8777 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8778 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8779 if(pCore->flRecordAttr & CRA_SELECTED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8780 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
8781 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
8782 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8783 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
8784 lastitem = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8785 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
8786 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8787
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8788 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8789 * Removes all nodes from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8790 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8791 * 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
8792 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8793 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
8794 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8795 dw_container_clear(handle, TRUE);
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8796 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8797
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8798 /*
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
8799 * 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
8800 * 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
8801 * 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
8802 * 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
8803 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8804 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
8805 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8806 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
8807 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8808
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8809 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8810 * 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
8811 * 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
8812 * 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
8813 * 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
8814 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8815 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
8816 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8817 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
8818 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8819
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
8820 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8821 * Removes a node from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8822 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8823 * 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
8824 * item: Handle to node to be deleted.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8825 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8826 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
8827 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8828 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8829
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8830 if(!item)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8831 return;
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 if(pci->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8834 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8835 free(pci->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8836 pci->rc.pszIcon = 0;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8839 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
8840 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
8841
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8842 /* 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
8843 typedef struct _containerinfo {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8844 int count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8845 void *data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8846 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
8847 } ContainerInfo;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8848
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8849 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8850 * Sets up the container columns.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8851 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8852 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8853 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8854 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8855 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8856 * separator: The column number that contains the main separator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8857 * (this item may only be used in OS/2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8858 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8859 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
8860 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8861 PFIELDINFO details, first, left = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8862 FIELDINFOINSERT detin;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8863 CNRINFO cnri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8864 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8865 ULONG size = sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8866 ULONG *offStruct = malloc(count * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8867 ULONG *tempflags = malloc((count+1) * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8868 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8869 ULONG *oldflags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8870
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8871 if(!offStruct || !tempflags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8872 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8873
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8874 memcpy(tempflags, flags, count * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8875 tempflags[count] = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8876
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8877 blah->data = tempflags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8878 blah->flags = separator;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8879
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8880 if(oldflags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8881 free(oldflags);
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 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
8884 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8885 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
8886 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8887
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8888 /* 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
8889 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8890 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8891 offStruct[z] = size;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8892 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8893 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8894 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8895 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8896 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8897 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8898 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8899 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8900 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8901 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8902 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8903
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8904 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
8905
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8906 if(!first)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8907 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8908 free(offStruct);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8909 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8910 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8911
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8912 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8913 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8914 if(z==separator-1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8915 left=details;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8916 details->cb = sizeof(FIELDINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8917 details->flData = flags[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8918 details->flTitle = CFA_FITITLEREADONLY;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8919 details->pTitleData = titles[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8920 details->offStruct = offStruct[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8921 details = details->pNextFieldInfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8922 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8923
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8924 detin.cb = sizeof(FIELDINFOINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8925 detin.fInvalidateFieldInfo = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8926 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8927 detin.cFieldInfoInsert = (ULONG)count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8928
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8929 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8930
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8931 if(count > separator && separator > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8932 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8933 cnri.cb = sizeof(CNRINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8934 cnri.pFieldInfoLast = left;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8935 cnri.xVertSplitbar = 150;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8936
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8937 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
8938 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8939
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8940 cnri.flWindowAttr = CV_DETAIL | CV_MINI | CA_DETAILSVIEWTITLES;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8941 cnri.slBitmapOrIcon.cx = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8942 cnri.slBitmapOrIcon.cy = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8943
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8944 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
8945
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8946 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
8947 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8948 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8949
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8950 /*
1744
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8951 * Configures the main filesystem columnn title for localization.
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8952 * Parameters:
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8953 * handle: Handle to the container to be configured.
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8954 * title: The title to be displayed in the main column.
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8955 */
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8956 void API dw_filesystem_set_column_title(HWND handle, char *title)
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8957 {
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8958 char *newtitle = strdup(title ? title : "");
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8959
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8960 dw_window_set_data(handle, "_dw_coltitle", newtitle);
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8961 }
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8962
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8963 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8964 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8965 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8966 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8967 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8968 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8969 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8970 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8971 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8972 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8973 char **newtitles = malloc(sizeof(char *) * (count + 2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8974 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2));
1744
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8975 char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle");
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8976
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8977 newtitles[0] = "";
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8978 newtitles[1] = coltitle ? coltitle : "Filename";
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8979
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8980 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
8981 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
8982
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8983 memcpy(&newtitles[2], titles, sizeof(char *) * count);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8984 memcpy(&newflags[2], flags, sizeof(unsigned long) * count);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8985
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8986 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
8987
1744
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8988 if(coltitle)
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8989 {
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8990 dw_window_set_data(handle, "_dw_coltitle", NULL);
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8991 free(coltitle);
535e8c19a13d Added dw_filesystem_set_column_title() function to aid in localization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1743
diff changeset
8992 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8993 free(newtitles);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8994 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
8995 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8996 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8997
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8998 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8999 * Obtains an icon from a module (or header in GTK).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9000 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9001 * module: Handle to module (DLL) in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9002 * id: A unsigned long id int the resources on OS/2 and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9003 * Windows, on GTK this is converted to a pointer
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9004 * to an embedded XPM.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9005 */
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
9006 HICN API dw_icon_load(unsigned long module, unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9007 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9008 return WinLoadPointer(HWND_DESKTOP,module,id);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9009 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9010
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9011 /* Internal function to create an icon from an existing pixmap */
1703
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9012 HICN _create_icon(HPIXMAP src)
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9013 {
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9014 HPIXMAP pntr = dw_pixmap_new(hwndApp, WinQuerySysValue(HWND_DESKTOP, SV_CXICON), WinQuerySysValue(HWND_DESKTOP, SV_CYICON), src->depth);
1702
1b10b4534bc4 Fixed creating icons from other file types on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1700
diff changeset
9015 HPIXMAP mask = dw_pixmap_new(hwndApp, pntr->width, pntr->height*2, 1);
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9016 HPIXMAP minipntr = dw_pixmap_new(hwndApp, pntr->width/2, pntr->height/2, src->depth);
1702
1b10b4534bc4 Fixed creating icons from other file types on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1700
diff changeset
9017 HPIXMAP minimask = dw_pixmap_new(hwndApp, minipntr->width, minipntr->height*2, 1);
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9018 ULONG oldcol = _foreground;
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9019 POINTERINFO pi = {0};
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9020
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9021 /* Create the color pointers, stretching it to the necessary size */
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9022 dw_pixmap_stretch_bitblt(0, pntr, 0, 0, pntr->width, pntr->height, 0, src, 0, 0, src->width, src->height);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9023 dw_pixmap_stretch_bitblt(0, minipntr, 0, 0, minipntr->width, minipntr->height, 0, src, 0, 0, src->width, src->height);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9024
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9025 /* Create the masks, all in black */
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9026 dw_color_foreground_set(DW_CLR_BLACK);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9027 dw_draw_rect(0, mask, DW_DRAW_FILL, 0, 0, mask->width, mask->height);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9028 dw_draw_rect(0, minimask, DW_DRAW_FILL, 0, 0, minimask->width, minimask->height);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9029 _foreground = oldcol;
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9030
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9031 /* Assemble the Pointer Info structure */
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9032 pi.hbmPointer = mask->hbm;
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9033 pi.hbmColor = pntr->hbm;
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9034 pi.hbmMiniPointer = minimask->hbm;
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9035 pi.hbmMiniColor = minipntr->hbm;
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9036
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9037 /* Destroy the pixmaps but not the bitmaps */
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9038 mask->hbm = pntr->hbm = minimask->hbm = minipntr->hbm = 0;
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9039 dw_pixmap_destroy(mask);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9040 dw_pixmap_destroy(pntr);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9041 dw_pixmap_destroy(minimask);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9042 dw_pixmap_destroy(minipntr);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9043
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9044 /* Generate the icon */
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9045 return WinCreatePointerIndirect(HWND_DESKTOP, &pi);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9046 }
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9047
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9048 /*
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
9049 * 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
9050 * 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
9051 * 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
9052 * 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
9053 * (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
9054 */
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
9055 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
9056 {
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9057 char *file = alloca(strlen(filename) + 6);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9058 HPIXMAP src = alloca(sizeof(struct _hpixmap));
1703
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9059 HICN icon = 0;
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9060
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9061 if(!file || !src)
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9062 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9063
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9064 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9065
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9066 /* 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
9067 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9068 {
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9069 int z;
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9070
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9071 /* Try with .ico extention */
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9072 strcat(file, ".ico");
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9073 if(access(file, 04) == 0)
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9074 return WinLoadFileIcon((PSZ)file, FALSE);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9075
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9076 /* Try with supported extensions */
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9077 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++)
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9078 {
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9079 strcpy(file, filename);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9080 strcat(file, image_exts[z]);
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9081 if(access(file, 04) == 0 &&
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9082 _load_bitmap_file(file, hwndApp, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth))
1703
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9083 {
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9084 icon = _create_icon(src);
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9085 break;
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9086 }
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9087 }
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9088 }
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9089 else if(_load_bitmap_file(file, hwndApp, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth))
1703
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9090 icon = _create_icon(src);
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9091 /* Free temporary resources if in use */
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9092 if(icon)
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9093 {
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9094 GpiSetBitmap(src->hps, NULLHANDLE);
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9095 GpiDeleteBitmap(src->hbm);
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9096 GpiAssociate(src->hps, NULLHANDLE);
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9097 GpiDestroyPS(src->hps);
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9098 DevCloseDC(src->hdc);
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9099 }
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9100 /* Otherwise fall back to the classic method */
1703
043db6b221c2 Cleanups on the icon creation code on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1702
diff changeset
9101 return icon ? icon : WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9102 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9103
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9104 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9105 * Obtains an icon from data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9106 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9107 * 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
9108 * DW pick the appropriate file extension.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9109 * (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
9110 */
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
9111 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
9112 {
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
9113 HICN icon=0;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9114 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9115 FILE *fp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9116
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9117 if ( !data )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9118 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9119 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9120 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9121 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9122 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9123 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9124 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9125 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9126 fclose( fp );
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
9127 icon = dw_icon_load_from_file(file);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9128 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9129 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9130 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9131 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
9132 }
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
9133
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
9134 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9135 * Frees a loaded resource in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9136 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9137 * handle: Handle to icon returned by dw_icon_load().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9138 */
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
9139 void API dw_icon_free(HICN handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9140 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9141 WinDestroyPointer(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9142 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9143
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9144 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9145 * Allocates memory used to populate a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9146 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9147 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9148 * rowcount: The number of items to be populated.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9149 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9150 void * API dw_container_alloc(HWND handle, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9151 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9152 WindowData *wd = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9153 ULONG *flags = wd ? wd->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9154 int z, size = 0, totalsize, count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9155 PRECORDCORE temp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9156 ContainerInfo *ci;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9157 void *blah = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9158
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9159 if(!flags || rowcount < 1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9160 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9161
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9162 while(flags[count])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9163 count++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9164
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9165 /* 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
9166 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9167 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9168 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9169 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9170 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9171 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9172 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9173 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9174 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9175 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9176 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9177 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9178 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9179
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9180 totalsize = size + sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9181
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9182 z = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9183
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9184 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
9185 return NULL;
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 temp = (PRECORDCORE)blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9188
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9189 for(z=0;z<rowcount;z++)
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 temp->cb = totalsize;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9192 temp = temp->preccNextRecord;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9195 ci = malloc(sizeof(struct _containerinfo));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9196
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9197 ci->count = rowcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9198 ci->data = blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9199 ci->handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9200
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9201 return (void *)ci;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9202 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9203
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9204 /* 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
9205 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
9206 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9207 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9208 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9209 int z, currentcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9210 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
9211 void *dest;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9212
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9213 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9214 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9215
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9216 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
9217 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9218
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9219 currentcount = cnr.cRecords;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9220
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9221 /* 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
9222 for(z=0;z<column;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9223 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9224 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9225 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9226 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9227 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9228 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9229 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9230 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9231 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9232 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9233 size += sizeof(CTIME);
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9236 totalsize = size + sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9237
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9238 for(z=0;z<(row-currentcount);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9239 temp = temp->preccNextRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9240
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9241 dest = (void *)(((ULONG)temp)+((ULONG)totalsize));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9242
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9243 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
9244 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
9245 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
9246 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
9247 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
9248 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
9249 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9250 else if(flags[column] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9251 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9252 char **newstr = (char **)data, **str = dest;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9253
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9254 if(*str)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9255 free(*str);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9256
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9257 if(newstr && *newstr)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9258 *str = strdup(*newstr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9259 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9260 *str = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9261 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9262 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
9263 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
9264 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
9265 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
9266 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
9267 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
9268 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9269 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
9270 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
9271 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
9272 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
9273 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
9274 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
9275 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9276 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
9277 {
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
9278 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
9279 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
9280 else
c6ab88dcf016 Allow dw_container_change/set_item() to accept NULL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1498
diff changeset
9281 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
9282 }
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
9283 }
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
9284
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
9285 /* 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
9286 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
9287 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9288 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9289 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9290 int z, count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9291
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9292 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9293 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9294
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9295 while(flags[count])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9296 count++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9297
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9298 /* 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
9299 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9300 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9301 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9302 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9303 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9304 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9305 char **str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9306
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9307 totalsize = size + sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9308
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9309 str = (char **)(((ULONG)temp)+((ULONG)totalsize));
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 if(*str)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9312 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9313 free(*str);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9314 *str = NULL;
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 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9317 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9318 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9319 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9320 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9321 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9322 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9323 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9324 }
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
9325 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
9326
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9327 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9328 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9329 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9330 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9331 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9332 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9333 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9334 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9335 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9336 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
9337 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9338 ContainerInfo *ci = (ContainerInfo *)pointer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9339
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9340 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9341 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9342
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9343 _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
9344 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9345
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9346 /*
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9347 * 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
9348 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9349 * 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
9350 * 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
9351 * 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
9352 * 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
9353 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9354 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
9355 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9356 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
9357 int count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9358
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9359 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9360 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9361 if(count == row)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9362 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9363 _dw_container_set_item(handle, pCore, column, 0, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9364 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
9365 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9366 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9367 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
9368 count++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9369 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9370 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9371
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9372 /*
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
9373 * 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
9374 * Parameters:
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
9375 * 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
9376 * 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
9377 * 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
9378 * 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
9379 */
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
9380 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
9381 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9382 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
9383 }
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
9384
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
9385 /*
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
9386 * 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
9387 * Parameters:
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
9388 * 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
9389 * 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
9390 * 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
9391 * 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
9392 * 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
9393 */
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
9394 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
9395 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9396 dw_container_change_item(handle, 0, row, (void *)&icon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9397 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
9398 }
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
9399
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
9400 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9401 * 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
9402 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9403 * 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
9404 * 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
9405 * 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
9406 * 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
9407 * 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
9408 */
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
9409 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
9410 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9411 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
9412 dw_container_set_item(handle, pointer, 1, row, (void *)&filename);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9413 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9414
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9415 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9416 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9417 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9418 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9419 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9420 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9421 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9422 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9423 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9424 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
9425 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9426 dw_container_set_item(handle, pointer, column + 2, row, data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9427 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9428
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9429 /*
508
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
9430 * 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
9431 * Parameters:
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
9432 * 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
9433 * 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
9434 */
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
9435 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
9436 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9437 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9438 ULONG *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9439 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9440
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9441 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9442 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9443
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9444 if(flags[column] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9445 rc = DW_CFA_BITMAPORICON;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9446 else if(flags[column] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9447 rc = DW_CFA_STRING;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9448 else if(flags[column] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9449 rc = DW_CFA_ULONG;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9450 else if(flags[column] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9451 rc = DW_CFA_DATE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9452 else if(flags[column] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9453 rc = DW_CFA_TIME;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9454 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9455 rc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9456 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
9457 }
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
9458
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
9459 /*
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
9460 * 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
9461 * Parameters:
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
9462 * 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
9463 * 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
9464 */
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
9465 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
9466 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9467 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
9468 }
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
9469
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
9470 /*
1208
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
9471 * 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
9472 * Parameters:
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
9473 * 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
9474 * 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
9475 * 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
9476 * 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
9477 * 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
9478 */
1291
b99b0b2c2826 Renamed dw_container_set_row_bg() to dw_container_set_stripe().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1290
diff changeset
9479 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
9480 {
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
9481 /* 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
9482 }
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
9483
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
9484 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9485 * 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
9486 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9487 * 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
9488 * 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
9489 * 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
9490 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9491 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
9492 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9493 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9494 column = column; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9495 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
9496 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9497
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9498 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9499 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9500 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9501 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9502 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9503 * title: String title of the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9504 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9505 void API dw_container_set_row_title(void *pointer, int row, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9506 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9507 ContainerInfo *ci = (ContainerInfo *)pointer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9508 PRECORDCORE temp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9509 int z, currentcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9510 CNRINFO cnr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9511
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9512 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9513 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9514
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9515 temp = (PRECORDCORE)ci->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9516
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9517 z = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9518
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9519 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
9520 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9521
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9522 currentcount = cnr.cRecords;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9523
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9524 for(z=0;z<(row-currentcount);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9525 temp = temp->preccNextRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9526
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9527 temp->pszIcon = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9528 temp->pszName = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9529 temp->pszText = (PSZ)title;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9530 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9531
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9532 /*
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
9533 * 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
9534 * 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
9535 * 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
9536 * 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
9537 * 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
9538 */
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
9539 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
9540 {
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
9541 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
9542 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
9543
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
9544 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
9545 {
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
9546 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
9547 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9548 pCore->pszIcon = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9549 pCore->pszName = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9550 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
9551
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
9552 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
9553 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
9554 }
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
9555 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
9556 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
9557 }
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
9558 }
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
9559
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
9560 /* 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
9561 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
9562 {
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
9563 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
9564
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
9565 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
9566 {
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
9567 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
9568 {
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
9569 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
9570 {
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
9571 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
9572 }
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
9573 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
9574 }
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
9575 }
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
9576 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
9577 }
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
9578
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
9579 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9580 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9581 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9582 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9583 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9584 * rowcount: The number of rows to be inserted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9585 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9586 void API dw_container_insert(HWND handle, void *pointer, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9587 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9588 RECORDINSERT recin;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9589 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
9590 PRECORDCORE pCore;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9591
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9592 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9593 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9594
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9595 recin.cb = sizeof(RECORDINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9596 recin.pRecordOrder = (PRECORDCORE)CMA_END;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9597 recin.pRecordParent = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9598 recin.zOrder = CMA_TOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9599 recin.fInvalidateRecord = TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9600 recin.cRecordsInsert = rowcount;
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_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
9603
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9604 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
9605
1693
b2311922a4de Ah so... eliminated the last few VAC36 warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1692
diff changeset
9606 if((pCore = _dw_container_start(handle, CRA_CURSORED)) != NULL)
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
9607 {
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
9608 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
9609
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
9610 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
9611 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
9612 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
9613 _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
9614 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
9615 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9616 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9617
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9618 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9619 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9620 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9621 * 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
9622 * 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
9623 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9624 void API dw_container_clear(HWND handle, int redraw)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9625 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9626 PCNRITEM pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9627 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
9628
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9629 if(hwndEmph == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9630 _clear_emphasis();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9631
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9632 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
9633
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9634 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9635 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9636 if(container)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9637 _dw_container_free_strings(handle, (PRECORDCORE)pCore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9638 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9639 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9640 /* Free icon text */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9641 if(pCore->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9642 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9643 free(pCore->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9644 pCore->rc.pszIcon = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9645 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9646 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9647 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
9648 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9649 _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
9650 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9651
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9652 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9653 * 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
9654 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9655 * 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
9656 * 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
9657 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9658 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
9659 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9660 RECORDCORE *last, **prc = malloc(sizeof(RECORDCORE *) * rowcount);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9661 int current = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9662
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9663 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
9664
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9665 while(last && current < rowcount)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9666 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9667 _dw_container_free_strings(handle, last);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9668 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
9669 current++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9670 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9671
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9672 _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
9673
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9674 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
9675 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9676
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9677 /*
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9678 * 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
9679 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9680 * 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
9681 * 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
9682 * 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
9683 * 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
9684 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9685 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
9686 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9687 rows = rows; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9688 switch(direction)
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 case DW_SCROLL_TOP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9691 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
9692 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9693 case DW_SCROLL_BOTTOM:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9694 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(10000000));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9695 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9696 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9697 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9698
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
9699 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9700 * Starts a new query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9701 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9702 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9703 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9704 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9705 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9706 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9707 char * API dw_container_query_start(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9708 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9709 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
9710
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9711 if(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9712 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9713 if(flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9714 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9715 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9716 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9717 if(pCore->flRecordAttr & flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9718 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9719 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
9720 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9721 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9722 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
9723 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9724 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9725 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9726 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9727 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
9728 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9729 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9730 }
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
9731 return NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9732 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9733
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9734 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9735 * Continues an existing query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9736 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9737 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9738 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9739 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9740 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9741 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9742 char * API dw_container_query_next(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9743 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9744 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
9745
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9746 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
9747
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9748 if(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9749 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9750 if(flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9751 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9752 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9753 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9754 if(pCore->flRecordAttr & flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9755 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9756 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
9757 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9758 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9759
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9760 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
9761 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9762 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9763 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9764 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9765 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
9766 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9767 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9768 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9769 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9770 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9771
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9772 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9773 * 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
9774 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9775 * 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
9776 * 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
9777 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9778 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
9779 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9780 RECTL viewport, item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9781 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
9782 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
9783
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9784 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9785 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9786 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
9787 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9788 QUERYRECORDRECT qrr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9789 int scrollpixels = 0, midway;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9790
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9791 qrr.cb = sizeof(QUERYRECORDRECT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9792 qrr.pRecord = pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9793 qrr.fRightSplitWindow = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9794 qrr.fsExtent = CMA_TEXT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9795
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9796 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
9797 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
9798 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9799
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9800 midway = (viewport.yTop - viewport.yBottom)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9801 scrollpixels = viewport.yTop - (item.yTop + midway);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9802
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9803 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(scrollpixels));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9804 return;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9807 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
9808 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9809 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9810
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9811 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9812 * 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
9813 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9814 * 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
9815 * 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
9816 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9817 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
9818 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9819 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
9820 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
9821
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9822 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9823 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9824 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
9825 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9826 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
9827 return;
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 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
9830 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9831 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9832
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
9833 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9834 * 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
9835 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9836 * 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
9837 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9838 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
9839 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9840 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9841 RECTL item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9842 PRECORDCORE pCore = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9843 int max = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9844
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9845 if(blah && !blah->flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9846 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9847
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9848 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
9849 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9850 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9851 QUERYRECORDRECT qrr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9852 int vector;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9853
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9854 qrr.cb = sizeof(QUERYRECORDRECT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9855 qrr.pRecord = pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9856 qrr.fRightSplitWindow = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9857 qrr.fsExtent = CMA_TEXT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9858
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9859 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9860
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9861 vector = item.xRight - item.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9862
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9863 if(vector > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9864 max = vector;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9865
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9866 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
9867 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9868
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9869 if(max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9870 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9871 CNRINFO cnri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9872
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9873 cnri.cb = sizeof(CNRINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9874 cnri.xVertSplitbar = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9875
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9876 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_XVERTSPLITBAR));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9877 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9878 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9879
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
9880 /*
487
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9881 * 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
9882 * Parameters:
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9883 * 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
9884 * 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
9885 * 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
9886 */
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
9887 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
9888 {
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9889 /* 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
9890 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
9891 return;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9892
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9893 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
9894 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
9895 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
9896 }
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9897
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9898 /*
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9899 * 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
9900 * Parameters:
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9901 * 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
9902 * 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
9903 */
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
9904 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
9905 {
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9906 /* 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
9907 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
9908 return;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9909
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
9910 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
9911 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
9912 }
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9913
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
9914 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9915 * Creates a rendering context widget (window) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9916 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9917 * id: An id to be used with dw_window_from_id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9918 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9919 * A handle to the widget or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9920 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9921 HWND API dw_render_new(unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9922 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9923 HWND hwndframe = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9924 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9925 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9926 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9927 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9928 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9929 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9930 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9931 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9932 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9933 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9934 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
9935 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
9936 return hwndframe;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9937 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9938
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9939 /* Sets the current foreground drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9940 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9941 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9942 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9943 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9944 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9945 void API dw_color_foreground_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9946 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9947 _foreground = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9948 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9949
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9950 /* Sets the current background drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9951 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9952 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9953 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9954 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9955 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9956 void API dw_color_background_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9957 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9958 _background = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9959 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9960
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
9961 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
9962 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9963 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9964 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
9965 void *val;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9966
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9967 window = (HWND)dwwait->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9968 val = dw_window_get_data(window, "_dw_val");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9969
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9970 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9971 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9972 dw_window_destroy(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9973 dw_dialog_dismiss((DWDialog *)data, val);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9974 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
9975 }
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
9976
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
9977 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
9978 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9979 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9980 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
9981 unsigned long val;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9982
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9983 window = (HWND)dwwait->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9984 val = _dw_color_spin_get(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9985
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9986 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9987 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9988 dw_window_destroy(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9989 dw_dialog_dismiss((DWDialog *)data, (void *)val);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9990 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
9991 }
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
9992
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9993 /* 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
9994 * Parameters:
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9995 * value: current color
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9996 * Returns:
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9997 * The selected color or the current color if cancelled.
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9998 */
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
9999 unsigned long API dw_color_choose(unsigned long value)
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
10000 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10001 HWND window, hbox, vbox, col, button, text;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10002 DWDialog *dwwait;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10003 HMTX mtx = dw_mutex_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10004
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
10005 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
10006
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10007 vbox = dw_box_new(DW_VERT, 5);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10008
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10009 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
10010
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10011 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10012
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10013 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
10014 dw_window_set_style(hbox, 0, WS_CLIPCHILDREN);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10015
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10016 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
10017 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
10018
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10019 dw_window_set_data(hbox, "_dw_window", (void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10020 dw_window_set_data(window, "_dw_mutex", (void *)mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10021 dw_window_set_data(window, "_dw_col", (void *)col);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10022 dw_window_set_data(window, "_dw_val", (void *)value);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10023
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10024 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10025 dw_window_set_data(hbox, "_dw_window", (void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10026
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10027 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
10028
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10029 text = dw_text_new("Red:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10030 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
10031 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
10032
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10033 button = dw_spinbutton_new("", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10034 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10035 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
10036 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10037 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
10038
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10039 text = dw_text_new("Green:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10040 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
10041 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
10042
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10043 button = dw_spinbutton_new("", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10044 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10045 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
10046 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10047 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
10048
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10049 text = dw_text_new("Blue:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10050 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
10051 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
10052
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10053 button = dw_spinbutton_new("", 1003L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10054 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10055 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
10056 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10057 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
10058
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10059 hbox = dw_box_new(DW_HORZ, 0);
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 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
10062 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
10063
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10064 button = dw_button_new("Ok", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10065 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
10066
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10067 dwwait = dw_dialog_new((void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10068
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10069 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
10070
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10071 button = dw_button_new("Cancel", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10072 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
10073
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10074 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
10075 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
10076
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10077 dw_window_set_size(window, 400, 400);
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 _dw_col_set(col, value);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10080 _dw_color_spin_set(window, value);
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 dw_window_show(window);
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 return (unsigned long)dw_dialog_wait(dwwait);
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
10085 }
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
10086
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10087 HPS _set_hps(HPS hps)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10088 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10089 LONG alTable[2];
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 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
10092 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
10093
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10094 GpiCreateLogColorTable(hps,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10095 LCOL_RESET,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10096 LCOLF_CONSECRGB,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10097 16,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10098 2,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10099 alTable);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10100 if(_foreground & DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10101 GpiSetColor(hps, 16);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10102 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10103 GpiSetColor(hps, _internal_color(_foreground));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10104 if(_background & DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10105 GpiSetBackColor(hps, 17);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10106 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10107 GpiSetBackColor(hps, _internal_color(_background));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10108 return hps;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10109 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10110
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10111 HPS _set_colors(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10112 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10113 HPS hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10114
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10115 _set_hps(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10116 return hps;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10117 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10118
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10119 /* Draw a point on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10120 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10121 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10122 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10123 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10124 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10125 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10126 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10127 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10128 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10129 int height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10130 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10131
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10132 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10133 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10134 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10135 height = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10136 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10137 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10138 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10139 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10140 height = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10141 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10142 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10143 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10144
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10145 ptl.x = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10146 ptl.y = height - y - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10147
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10148 GpiSetPel(hps, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10149 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10150 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10151 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10152
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10153 /* Draw a line on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10154 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10155 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10156 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10157 * x1: First X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10158 * y1: First Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10159 * x2: Second X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10160 * y2: Second Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10161 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10162 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
10163 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10164 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10165 int height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10166 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10167
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10168 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10169 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10170 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10171 height = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10172 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10173 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10174 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10175 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10176 height = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10177 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10178 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10179 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10180
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10181 ptl[0].x = x1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10182 ptl[0].y = height - y1 - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10183 ptl[1].x = x2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10184 ptl[1].y = height - y2 - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10185
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10186 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10187 GpiLine(hps, &ptl[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10188
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10189 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10190 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10191 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10192
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10193
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
10194 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
10195 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10196 FONTMETRICS fm;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10197 FATTRS fat;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10198 SIZEF sizf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10199
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10200 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
10201
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10202 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
10203
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10204 fat.usRecordLength = sizeof(FATTRS);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10205 fat.lMatch = fm.lMatch;
1689
3fb7002e4de6 Unicode (UTF-8) mode on OS/2 as noted to me by Alex Taylor comes with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1688
diff changeset
10206 #ifdef UNICODE
1676
007bced14910 Explicitly set codepage 1208 for GPI rendering on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1673
diff changeset
10207 fat.usCodePage = 1208;
1689
3fb7002e4de6 Unicode (UTF-8) mode on OS/2 as noted to me by Alex Taylor comes with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1688
diff changeset
10208 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10209 strcpy(fat.szFacename, fm.szFacename);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10210
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10211 GpiCreateLogFont(hpsDst, 0, 1L, &fat);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10212 GpiSetCharSet(hpsDst, 1L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10213
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10214 sizf.cx = MAKEFIXED(fm.lEmInc,0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10215 sizf.cy = MAKEFIXED(fm.lMaxBaselineExt,0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10216 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
10217 }
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
10218
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10219 /* Draw text on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10220 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10221 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10222 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10223 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10224 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10225 * text: Text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10226 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10227 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
10228 {
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
10229 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
10230 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
10231 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
10232 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
10233 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
10234
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
10235 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
10236 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
10237 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
10238 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
10239 _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
10240 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
10241 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
10242 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
10243 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
10244
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
10245 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
10246 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
10247 _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
10248 _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
10249 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
10250 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
10251 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
10252 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
10253
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
10254 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
10255 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
10256 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
10257 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
10258 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
10259
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10260 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
10261
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
10262 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
10263 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
10264 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
10265 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
10266
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 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
10268 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
10269 else
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10270 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
10271
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
10272 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
10273 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10274 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10275
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
10276 /* 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
10277 * 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
10278 * 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
10279 * 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
10280 * 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
10281 * 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
10282 * 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
10283 */
514
08d770271709 More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 513
diff changeset
10284 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
10285 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10286 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10287 POINTL aptl[TXTBOX_COUNT];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10288
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10289 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10290 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10291 hps = _set_colors(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10292 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10293 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10294 {
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
10295 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
10296
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10297 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10298 _CopyFontSettings(pixmaphps, hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10299 WinReleasePS(pixmaphps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10300 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10301 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10302 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10303
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10304 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
10305
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10306 if(width)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10307 *width = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10308
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10309 if(height)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10310 *height = aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10311
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10312 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10313 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
10314 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10315
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10316 /* 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
10317 * Parameters:
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10318 * handle: Handle to the window.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10319 * 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
10320 * 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
10321 * x: X coordinate.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10322 * y: Y coordinate.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10323 * width: Width of rectangle.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10324 * height: Height of rectangle.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10325 */
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
10326 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
10327 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10328 HPS hps;
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10329 int thisheight;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10330 POINTL *pptl;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10331 POINTL start;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10332 int i;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10333
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10334 if(handle)
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10335 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10336 hps = _set_colors(handle);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10337 thisheight = _get_height(handle);
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10338 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10339 else if(pixmap)
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10340 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10341 hps = _set_hps(pixmap->hps);
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10342 thisheight = pixmap->height;
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10343 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10344 else
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10345 return;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10346 if ( npoints == 0 )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10347 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10348 pptl = (POINTL *)malloc(sizeof(POINTL)*npoints);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10349 if ( pptl == NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10350 return;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10351 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10352 * 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
10353 */
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
10354 if ( flags & DW_DRAW_FILL )
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10355 GpiBeginArea( hps, 0L );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10356 if ( npoints )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10357 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10358 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10359 * 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
10360 */
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10361 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
10362 start.y = thisheight - y[0] - 1;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10363 GpiMove( hps, &start );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10364 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10365 * 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
10366 */
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10367 for ( i = 1; i < npoints; i++ )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10368 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10369 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
10370 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
10371 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10372 GpiPolyLine( hps, npoints-1, pptl );
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10373
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
10374 if ( flags & DW_DRAW_FILL )
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10375 GpiEndArea( hps );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10376 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10377 if ( !pixmap )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10378 WinReleasePS(hps);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10379 free( pptl );
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10380 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
10381
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10382 /* Draw a rectangle on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10383 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10384 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10385 * 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
10386 * flags: DW_DRAW_FILL (1) to fill the box or DW_DRAW_DEFAULT (0).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10387 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10388 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10389 * width: Width of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10390 * height: Height of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10391 */
1276
1cdc18d760e0 Fixed improper fill method in dw_draw_rect() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1275
diff changeset
10392 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
10393 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10394 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10395 int thisheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10396 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10397
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10398 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10399 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10400 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10401 thisheight = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10402 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10403 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10404 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10405 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10406 thisheight = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10407 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10408 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10409 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10410
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10411 ptl[0].x = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10412 ptl[0].y = thisheight - y - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10413 ptl[1].x = x + width - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10414 ptl[1].y = thisheight - y - height;
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 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
10417 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
10418
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10419 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10420 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10421 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10422
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
10423 /* 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
10424 #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
10425 #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
10426 #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
10427
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10428 /* 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
10429 * Parameters:
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10430 * 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
10431 * 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
10432 * 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
10433 * 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
10434 * 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
10435 * 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
10436 * 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
10437 * 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
10438 * 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
10439 * 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
10440 */
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10441 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
10442 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10443 HPS hps;
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10444 int thisheight;
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10445 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
10446 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
10447 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
10448
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10449 if(handle)
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10450 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10451 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
10452 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
10453 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10454 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
10455 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10456 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
10457 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
10458 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10459 else
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10460 return;
1274
885b55c0d7d7 Implemented DW_DRAW_FULL and DW_DRAW_FILL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1262
diff changeset
10461
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
10462 /* 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
10463 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
10464 {
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
10465 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
10466 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
10467 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
10468 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
10469 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
10470 /* 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
10471 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
10472 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
10473 }
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
10474 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
10475 {
1290
d2c4deea6bf6 Simplified fill for ellipses and circles on OS/2 using DRO_OUTLINEFILL.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1286
diff changeset
10476 /* 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
10477 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
10478 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
10479
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
10480 /* 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
10481 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
10482 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
10483 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
10484 /* 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
10485 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
10486 /* 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
10487 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
10488 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
10489 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
10490 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
10491 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
10492 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
10493 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
10494 /* 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
10495 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
10496 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
10497 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
10498 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
10499 /* 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
10500 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
10501 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
10502 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
10503 }
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10504
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10505 if(!pixmap)
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10506 WinReleasePS(hps);
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10507 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
10508
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10509 /* Call this after drawing to the screen to make sure
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10510 * anything you have drawn is visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10511 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10512 void API dw_flush(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10513 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10514 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10515
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10516 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10517 * Creates a pixmap with given parameters.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10518 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10519 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10520 * width: Width of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10521 * height: Height of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10522 * depth: Color depth of the pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10523 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10524 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10525 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10526 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
10527 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10528 BITMAPINFOHEADER bmih;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10529 SIZEL sizl = { 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10530 HPIXMAP pixmap;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10531 HDC hdc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10532 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10533 ULONG ulFlags;
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
10534 LONG cPlanes, cBitCount;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10535
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10536 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10537 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10538
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10539 hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10540
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10541 hdc = GpiQueryDevice(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10542 ulFlags = GpiQueryPS(hps, &sizl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10543
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10544 pixmap->handle = handle;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10545 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
10546 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
10547
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10548 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10549 if (!depth)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10550 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10551 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10552 depth = cBitCount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10553 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10554
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10555 memset(&bmih, 0, sizeof(BITMAPINFOHEADER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10556 bmih.cbFix = sizeof(BITMAPINFOHEADER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10557 bmih.cx = (SHORT)width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10558 bmih.cy = (SHORT)height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10559 bmih.cPlanes = (SHORT)cPlanes;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10560 bmih.cBitCount = (SHORT)depth;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10561
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10562 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
10563 pixmap->transcolor = DW_CLR_DEFAULT;
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
10564 pixmap->depth = depth;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10565
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10566 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
10567
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10568 GpiSetBitmap(pixmap->hps, pixmap->hbm);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10569
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10570 if (depth>8)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10571 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
10572
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10573 WinReleasePS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10574
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10575 return pixmap;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10576 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10577
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10578 /*
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10579 * Creates a pixmap from a file.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10580 * Parameters:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10581 * 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
10582 * 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
10583 * DW pick the appropriate file extension.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10584 * (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
10585 * Returns:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10586 * 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
10587 */
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10588 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
10589 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10590 HPIXMAP pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10591 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10592
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10593 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
10594 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10595
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10596 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10597
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10598 /* 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
10599 if ( access(file, 04) != 0 )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10600 {
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
10601 int z;
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
10602
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
10603 /* Try with supported extensions */
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
10604 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++)
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
10605 {
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
10606 strcpy(file, filename);
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
10607 strcat(file, image_exts[z]);
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
10608 if(access(file, 04) == 0 &&
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
10609 _load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth))
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
10610 break;
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
10611 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10612 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10613
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10614 /* Try to load the bitmap from file */
1698
e31c7e389b2f More fixes to the GBM code on OS/2... if loading a file fails...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1697
diff changeset
10615 if(!pixmap->hbm)
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10616 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10617 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10618 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10619 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10620
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10621 /* Success fill in other values */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10622 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
10623 pixmap->transcolor = DW_CLR_DEFAULT;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10624
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10625 return pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10626 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10627
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10628 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10629 * Creates a pixmap from memory.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10630 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10631 * 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
10632 * data: Source of the image data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10633 * (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
10634 * le: length of data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10635 * Returns:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10636 * 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
10637 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10638 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
10639 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10640 HPIXMAP pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10641 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10642 FILE *fp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10643
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10644 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
10645 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10646
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10647 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10648 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10649 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10650 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10651 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10652 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10653 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10654 fclose( fp );
1700
4487f6bc9e8b Initial attempt at creating icons from other formats on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1699
diff changeset
10655 if(!_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth))
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
10656 {
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
10657 /* can't use ICO ? */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10658 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10659 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10660 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10661 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10662 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10663 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10664 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10665 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10666 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10667 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10668 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10669
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10670 /* Success fill in other values */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10671 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
10672 pixmap->transcolor = DW_CLR_DEFAULT;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10673
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10674 return pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10675 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10676
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10677 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10678 * 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
10679 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10680 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
10681 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10682 if ( pixmap )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10683 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10684 pixmap->transcolor = _internal_color(color);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10685 }
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10686 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10687
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
10688 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10689 * Creates a pixmap from internal resource graphic specified by id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10690 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10691 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10692 * id: Resource ID associated with requested pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10693 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10694 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10695 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10696 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10697 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10698 BITMAPINFOHEADER bmih;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10699 SIZEL sizl = { 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10700 HPIXMAP pixmap;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10701 HDC hdc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10702 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10703 ULONG ulFlags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10704
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10705 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10706 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10707
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10708 hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10709
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10710 hdc = GpiQueryDevice(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10711 ulFlags = GpiQueryPS(hps, &sizl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10712
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10713 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
10714 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
10715
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10716 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10717
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10718 GpiQueryBitmapParameters(pixmap->hbm, &bmih);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10719
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10720 GpiSetBitmap(pixmap->hps, pixmap->hbm);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10721
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10722 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
10723 pixmap->transcolor = DW_CLR_DEFAULT;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10724
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10725 WinReleasePS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10726
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10727 return pixmap;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10728 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10729
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10730 /*
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10731 * 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
10732 * 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
10733 * 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
10734 * Parameters:
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10735 * 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
10736 * 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
10737 * 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
10738 * Returns:
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10739 * 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
10740 */
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10741 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
10742 {
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10743 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
10744 {
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
10745 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
10746 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
10747 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
10748 return DW_ERROR_NONE;
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10749 }
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10750 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
10751 }
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10752
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
10753 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10754 * Destroys an allocated pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10755 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10756 * pixmap: Handle to a pixmap returned by
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10757 * dw_pixmap_new..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10758 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10759 void API dw_pixmap_destroy(HPIXMAP pixmap)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10760 {
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
10761 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
10762 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
10763 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
10764 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
10765 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
10766 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
10767 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
10768 free(pixmap);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10769 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10770
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10771 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10772 * Copies from one item to another.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10773 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10774 * dest: Destination window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10775 * destp: Destination pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10776 * xdest: X coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10777 * ydest: Y coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10778 * width: Width of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10779 * height: Height of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10780 * src: Source window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10781 * srcp: Source pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10782 * xsrc: X coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10783 * ysrc: Y coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10784 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10785 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
10786 {
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10787 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
10788 }
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10789
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10790 /*
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10791 * 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
10792 * Parameters:
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10793 * 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
10794 * 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
10795 * 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
10796 * 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
10797 * 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
10798 * 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
10799 * 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
10800 * 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
10801 * 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
10802 * 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
10803 * 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
10804 * 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
10805 * Returns:
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10806 * 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
10807 */
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10808 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
10809 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10810 HPS hpsdest;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10811 HPS hpssrc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10812 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
10813 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
10814 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
10815
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
10816 /* 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
10817 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
10818 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
10819
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10820 if(dest)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10821 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10822 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
10823 dheight = _get_height(dest);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10824 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10825 else if(destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10826 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10827 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
10828 dheight = destp->height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10829 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10830 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
10831 return DW_ERROR_GENERAL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10832
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10833 if(src)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10834 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10835 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
10836 sheight = _get_height(src);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10837 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10838 else if(srcp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10839 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10840 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
10841 sheight = srcp->height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10842 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10843 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10844 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10845 if(!destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10846 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
10847 return DW_ERROR_GENERAL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10848 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10849
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10850 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
10851 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
10852 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
10853 ptl[1].y = dheight - ydest;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10854 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
10855 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
10856 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
10857 {
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
10858 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
10859 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
10860 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
10861 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10862
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
10863 /* 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
10864 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
10865 {
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
10866 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
10867 /* 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
10868 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
10869 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
10870 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
10871 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
10872 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
10873 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
10874 }
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
10875 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
10876 {
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
10877 /* 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
10878 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
10879 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10880
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10881 if(!destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10882 WinReleasePS(hpsdest);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10883 if(!srcp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10884 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
10885 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10886 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10887
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
10888 /* 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
10889 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
10890 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10891 int *info = (int *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10892
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10893 if(data)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10894 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10895 DosBeep(info[0], info[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10896 free(data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10897 }
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
10898 }
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
10899
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10900 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10901 * Emits a beep.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10902 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10903 * freq: Frequency.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10904 * dur: Duration.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10905 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10906 void API dw_beep(int freq, int dur)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10907 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10908 int *info = malloc(sizeof(int) * 2);
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 if(info)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10911 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10912 info[0] = freq;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10913 info[1] = dur;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10914
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10915 _beginthread(_beepthread, NULL, 100, (void *)info);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10916 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10917 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10918
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10919 /* Open a shared library and return a handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10920 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10921 * name: Base name of the shared library.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10922 * handle: Pointer to a module handle,
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10923 * will be filled in with the handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10924 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10925 int API dw_module_load(char *name, HMOD *handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10926 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10927 char objnamebuf[300] = "";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10928
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10929 return DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)name, handle);
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10930 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10931
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10932 /* Queries the address of a symbol within open handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10933 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10934 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10935 * name: Name of the symbol you want the address of.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10936 * func: A pointer to a function pointer, to obtain
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10937 * the address.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10938 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10939 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
10940 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10941 return DosQueryProcAddr(handle, 0, (PSZ)name, (PFN*)func);
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10942 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10943
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10944 /* Frees the shared library previously opened.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10945 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10946 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10947 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10948 int API dw_module_close(HMOD handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10949 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10950 DosFreeModule(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10951 return 0;
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10952 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
10953
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10954 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10955 * Returns the handle to an unnamed mutex semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10956 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10957 HMTX API dw_mutex_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10958 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10959 HMTX mutex;
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 DosCreateMutexSem(NULL, &mutex, 0, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10962 return mutex;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10963 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10964
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10965 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10966 * Closes a semaphore created by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10967 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10968 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10969 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10970 void API dw_mutex_close(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10971 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10972 DosCloseMutexSem(mutex);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10973 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10974
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10975 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10976 * 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
10977 * 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
10978 * while blocking.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10979 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10980 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10981 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10982 void API dw_mutex_lock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10983 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10984 if(_dwtid == dw_thread_id())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10985 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10986 int rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN);
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 while(rc == ERROR_TIMEOUT)
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 dw_main_sleep(10);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10991 rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10992 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10993 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
10994 else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10995 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10996 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10997
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10998 /*
1158
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
10999 * 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
11000 * Parameters:
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
11001 * 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
11002 * Returns:
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
11003 * 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
11004 */
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
11005 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
11006 {
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
11007 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
11008 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
11009 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
11010 }
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
11011
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
11012 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11013 * Reliquishes the access to the semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11014 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11015 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11016 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11017 void API dw_mutex_unlock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11018 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11019 DosReleaseMutexSem(mutex);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11020 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11021
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11022 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11023 * Returns the handle to an unnamed event semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11024 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11025 HEV API dw_event_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11026 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11027 HEV blah;
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 if(DosCreateEventSem (NULL, &blah, 0L, FALSE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11030 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11031
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11032 return blah;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11033 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11034
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11035 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11036 * Resets a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11037 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11038 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11039 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11040 int API dw_event_reset(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11041 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11042 ULONG count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11043
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11044 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
11045 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
11046 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11047 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11048
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11049 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11050 * Posts a semaphore created by dw_event_new(). Causing all threads
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11051 * waiting on this event in dw_event_wait to continue.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11052 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11053 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11054 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11055 int API dw_event_post(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11056 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11057 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
11058 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
11059 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11060 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11061
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11062
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11063 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11064 * Waits on a semaphore created by dw_event_new(), until the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11065 * event gets posted or until the timeout expires.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11066 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11067 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11068 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11069 int API dw_event_wait(HEV eve, unsigned long timeout)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11070 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11071 int rc = DosWaitEventSem(eve, timeout);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11072 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
11073 return DW_ERROR_NONE;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11074 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
11075 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
11076 return DW_ERROR_GENERAL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11077 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11078
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11079 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11080 * Closes a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11081 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11082 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11083 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11084 int API dw_event_close(HEV *eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11085 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11086 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
11087 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
11088 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11089 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11090
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
11091 /* 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
11092 * 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
11093 * 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
11094 * 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
11095 * 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
11096 * 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
11097 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11098 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
11099 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11100 char *semname = malloc(strlen(name)+8);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11101 HEV ev = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11102
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11103 if(!semname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11104 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11105
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11106 strcpy(semname, "\\sem32\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11107 strcat(semname, name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11108
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11109 DosCreateEventSem((PSZ)semname, &ev, 0L, FALSE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11110
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11111 free(semname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11112 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
11113 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11114
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11115 /* 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
11116 * 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
11117 * 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
11118 * 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
11119 * 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
11120 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11121 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
11122 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11123 char *semname = malloc(strlen(name)+8);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11124 HEV ev;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11125
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11126 if(!semname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11127 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11128
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11129 strcpy(semname, "\\sem32\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11130 strcat(semname, name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11131
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11132 DosOpenEventSem((PSZ)semname, &ev);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11133
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11134 free(semname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11135 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
11136 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11137
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11138 /* 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
11139 * 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
11140 * 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
11141 * 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
11142 * 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
11143 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11144 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
11145 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11146 ULONG count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11147
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11148 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
11149 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11150
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11151 /* 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
11152 * 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
11153 * 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
11154 * 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
11155 * 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
11156 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11157 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
11158 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11159 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
11160 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11161
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11162
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11163 /* 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
11164 * 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
11165 * 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
11166 * 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
11167 * 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
11168 * 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
11169 * 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
11170 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11171 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
11172 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11173 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11174
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11175 rc = DosWaitEventSem(eve, timeout);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11176 switch (rc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11177 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11178 case ERROR_INVALID_HANDLE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11179 rc = DW_ERROR_NON_INIT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11180 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11181 case ERROR_NOT_ENOUGH_MEMORY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11182 rc = DW_ERROR_NO_MEM;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11183 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11184 case ERROR_INTERRUPT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11185 rc = DW_ERROR_INTERRUPT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11186 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11187 case ERROR_TIMEOUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11188 rc = DW_ERROR_TIMEOUT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11189 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11192 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
11193 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11194
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11195 /* 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
11196 * 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
11197 * 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
11198 * 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
11199 * 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
11200 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11201 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
11202 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11203 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11204
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11205 rc = DosCloseEventSem(eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11206 switch (rc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11207 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11208 case ERROR_INVALID_HANDLE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11209 rc = DW_ERROR_NON_INIT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11210 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11211
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11212 case ERROR_SEM_BUSY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11213 rc = DW_ERROR_INTERRUPT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11214 break;
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11217 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
11218 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11219
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11220 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11221 * 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
11222 * 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
11223 * 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
11224 * 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
11225 * 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
11226 * 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
11227 */
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
11228 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
11229 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11230 char namebuf[1024];
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 sprintf(namebuf, "\\sharemem\\%s", name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11233
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11234 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
11235 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11236
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11237 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
11238 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11239
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11240 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11241 * 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
11242 * 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
11243 * 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
11244 * 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
11245 * 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
11246 */
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
11247 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
11248 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11249 char namebuf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11250
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11251 size = size;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11252 sprintf(namebuf, "\\sharemem\\%s", name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11253
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11254 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
11255 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11256
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11257 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
11258 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11259
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11260 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11261 * 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
11262 * 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
11263 * 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
11264 * 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
11265 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11266 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
11267 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11268 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11269
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11270 if(DosFreeMem(ptr) != NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11271 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11272 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
11273 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
11274
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11275 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11276 * Encapsulate the message queues on OS/2.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11277 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11278 void _dwthreadstart(void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11279 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11280 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
11281 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
11282 void (API_FUNC threadfunc)(void *) = NULL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11283 void **tmp = (void **)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11284
1689
3fb7002e4de6 Unicode (UTF-8) mode on OS/2 as noted to me by Alex Taylor comes with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1688
diff changeset
11285 #ifdef UNICODE
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
11286 /* 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
11287 WinSetCp(thishmq, 1208);
1689
3fb7002e4de6 Unicode (UTF-8) mode on OS/2 as noted to me by Alex Taylor comes with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1688
diff changeset
11288 #endif
3fb7002e4de6 Unicode (UTF-8) mode on OS/2 as noted to me by Alex Taylor comes with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1688
diff changeset
11289
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
11290 threadfunc = (void (API_FUNC)(void *))tmp[0];
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11291 threadfunc(tmp[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11292
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11293 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11294
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11295 WinDestroyMsgQueue(thishmq);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11296 WinTerminate(thishab);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11297 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11298
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11299 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11300 * Creates a new thread with a starting point of func.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11301 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11302 * func: Function which will be run in the new thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11303 * data: Parameter(s) passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11304 * stack: Stack size of new thread (OS/2 and Windows only).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11305 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11306 DWTID API dw_thread_new(void *func, void *data, int stack)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11307 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11308 void **tmp = malloc(sizeof(void *) * 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11309
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11310 tmp[0] = func;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11311 tmp[1] = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11312
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11313 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11314 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11315
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11316 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11317 * Ends execution of current thread immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11318 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11319 void API dw_thread_end(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11320 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11321 _endthread();
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11322 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11323
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11324 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11325 * Returns the current thread's ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11326 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11327 DWTID API dw_thread_id(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11328 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11329 return (DWTID)_threadid;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11330 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11331
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11332 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11333 * Cleanly terminates a DW session, should be signal handler safe.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11334 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11335 * exitcode: Exit code reported to the operating system.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11336 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11337 void API dw_exit(int exitcode)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11338 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11339 /* Destroy the menu message window */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11340 dw_window_destroy(hwndApp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11341
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11342 /* 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
11343 * try to free memory that could possibly be
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11344 * free()'d by the runtime already.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11345 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11346 Root = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11347
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
11348 /* Deinit the GBM */
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
11349 if(_gbm_deinit)
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
11350 _gbm_deinit();
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
11351
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
11352 /* 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
11353 WinDestroyMsgQueue(dwhmq);
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
11354 WinTerminate(dwhab);
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
11355
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
11356 /* Free any in use modules */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11357 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
11358 DosFreeModule(pmprintf);
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
11359 DosFreeModule(pmmerge);
1696
c01961b48c40 Added initial support on OS/2 for runtime loading GBM
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1693
diff changeset
11360 DosFreeModule(gbm);
1528
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
11361
5facb5380944 Added dw_main_quit() function for exiting the dw_main() loop.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1520
diff changeset
11362 /* And finally exit */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11363 exit(exitcode);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11364 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11365
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11366 /*
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
11367 * 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
11368 * 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
11369 * 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
11370 * 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
11371 * 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
11372 * 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
11373 * 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
11374 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11375 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
11376 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11377 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
11378 (PSZ)SplitbarClassName,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11379 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11380 WS_VISIBLE | WS_CLIPCHILDREN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11381 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11382 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11383 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11384 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11385 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11386 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11387 if(tmp)
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 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
11390 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
11391
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11392 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
11393 WinSetParent(tmpbox, tmp, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11394 dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox);
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 tmpbox = dw_box_new(DW_VERT, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11397 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
11398 WinSetParent(tmpbox, tmp, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11399 *percent = 50.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11400 dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11401 dw_window_set_data(tmp, "_dw_percent", (void *)percent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11402 dw_window_set_data(tmp, "_dw_type", (void *)type);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11403 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11404 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
11405 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
11406
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
11407 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
11408 * 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
11409 * 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
11410 * 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
11411 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11412 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
11413 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11414 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
11415 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
11416 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
11417
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11418 if(mypercent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11419 *mypercent = percent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11420
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11421 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
11422
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11423 _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
11424 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
11425
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
11426 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
11427 * 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
11428 * 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
11429 * 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
11430 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11431 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
11432 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11433 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
11434
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11435 if(percent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11436 return *percent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11437 return 0.0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11438 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11439
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11440 /* The following two functions graciously contributed by Peter Nielsen. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11441 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11442 char* pchStart = pchBuffer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11443 char* pchEnd = pchStart + ulSize - 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11444
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11445 while (pchEnd >= pchStart)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11446 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11447 if ((pchEnd[0] == '#') && (pchEnd[1] == '@'))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11448 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11449 *pchEnd-- = '\0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11450 while (pchEnd >= pchStart)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11451 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11452 if ((pchEnd[0] == '@') && (pchEnd[1] == '#'))
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 ULONG ulMajor = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11455 ULONG ulMinor = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11456
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11457 char* pch = pchEnd + 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11458 while (!isdigit ((int)*pch) && *pch)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11459 pch++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11460
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11461 while (isdigit ((int)*pch))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11462 ulMajor = ulMajor * 10 + *pch++ - '0';
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 (*pch == '.')
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 while (isdigit ((int)*++pch))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11467 ulMinor = ulMinor * 10 + *pch - '0';
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 return ((ulMajor << 16) | ulMinor);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11470 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11471 pchEnd--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11472 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11473 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11474 pchEnd--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11475 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11476 return (0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11477 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11478
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11479 ULONG _GetSystemBuildLevel(void) {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11480 /* 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
11481 * 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
11482 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11483 ULONG ulBootDrive = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11484 ULONG ulBuild = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11485 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
11486 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11487 char achFileName[11] = "C:\\OS2KRNL";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11488 HFILE hfile;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11489 ULONG ulResult;
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11490
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11491 achFileName[0] = (char)('A'+ulBootDrive-1);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11492
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11493 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
11494 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11495 ULONG ulFileSize = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11496 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11497 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11498 const ULONG ulFirstTry = min (256, ulFileSize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11499 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
11500 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11501 char *pchBuffer = malloc(ulFirstTry);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11502 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR)
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 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11505 if (ulBuild == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11506 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11507 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11508 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11509 free(pchBuffer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11510 pchBuffer = malloc(ulFileSize);
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 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11513 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11514 }
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11517 free(pchBuffer);
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 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11520 DosClose (hfile);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11521 }
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 return (ulBuild);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11524 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11525
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
11526 /*
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
11527 * 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
11528 * 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
11529 * 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
11530 * 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
11531 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11532 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
11533 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11534 Box *thisbox = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11535 HWND box;
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 box = WinWindowFromID(window, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11538 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11539 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11540
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11541 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11542 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
11543 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11544
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11545 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
11546 * 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
11547 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
11548 * 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
11549 * 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
11550 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11551 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
11552 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11553 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11554
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11555 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11556 blah->clickdefault = next;
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
11557 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
11558
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
11559 /*
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11560 * 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
11561 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11562 * None.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11563 * Returns:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11564 * 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
11565 * be converted to text.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11566 */
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
11567 char * API dw_clipboard_get_text(void)
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11568 {
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
11569 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
11570 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
11571 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
11572
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11573 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
11574
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11575 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
11576 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
11577 {
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11578 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
11579 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
11580 }
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11581 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
11582 return retbuf;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11583 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11584
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11585 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11586 * 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
11587 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11588 * Text.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11589 */
1697
f5b187156cc0 Added image extension list for OS/2 for use when using GBM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1696
diff changeset
11590 void API dw_clipboard_set_text( char *str, int len )
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11591 {
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
11592 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
11593 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
11594
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11595 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
11596 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
11597
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11598 /* 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
11599
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11600 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
11601 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
11602
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11603 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
11604 {
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11605 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
11606
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11607 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
11608 }
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11609
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11610 WinCloseClipbrd(dwhab); /* Close clipboard */
822
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
11611 return;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11612 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11613
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11614 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11615 * Returns some information about the current operating environment.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11616 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11617 * env: Pointer to a DWEnv struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11618 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11619 void API dw_environment_query(DWEnv *env)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11620 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11621 ULONG Build;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11622
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11623 if(!env)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11624 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11625
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11626 /* The default is OS/2 2.0 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11627 strcpy(env->osName,"OS/2");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11628 env->MajorVersion = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11629 env->MinorVersion = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11630
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11631 Build = _GetSystemBuildLevel();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11632 env->MinorBuild = Build & 0xFFFF;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11633 env->MajorBuild = Build >> 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11634
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11635 if (aulBuffer[0] == 20)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11636 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11637 int i = (unsigned int)aulBuffer[1];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11638 if (i > 20)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11639 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11640 strcpy(env->osName,"Warp");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11641 env->MajorVersion = (int)i/10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11642 env->MinorVersion = i-(((int)i/10)*10);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11643 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11644 else if (i == 10)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11645 env->MinorVersion = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11646 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11647 strcpy(env->buildDate, __DATE__);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11648 strcpy(env->buildTime, __TIME__);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11649 env->DWMajorVersion = DW_MAJOR_VERSION;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11650 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
11651 #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
11652 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
11653 #else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11654 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
11655 #endif
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11656 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11657
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11658 /* 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
11659 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
11660 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11661 FILEFINDBUF3 ffbuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11662 HTREEITEM item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11663 ULONG count = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11664 HDIR hdir = HDIR_CREATE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11665
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11666 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
11667 &ffbuf, sizeof(FILEFINDBUF3), &count, FIL_STANDARD) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11668 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11669 while(DosFindNext(hdir, &ffbuf, sizeof(FILEFINDBUF3), &count) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11670 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11671 if(strcmp(ffbuf.achName, ".") && strcmp(ffbuf.achName, ".."))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11672 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11673 int len = strlen(path);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11674 char *folder = malloc(len + ffbuf.cchName + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11675 HTREEITEM tempitem;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11676
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11677 strcpy(folder, path);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11678 strcpy(&folder[len-1], ffbuf.achName);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11679
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11680 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
11681 tempitem = dw_tree_insert(tree, "", 0, item, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11682 dw_tree_item_set_data(tree, item, (void *)tempitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11683 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11684 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11685 DosFindClose(hdir);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11686 }
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11687 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11688
906
71b0e132d9df Added missing API to _popuplate_tree_thread() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 904
diff changeset
11689 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
11690 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11691 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
11692 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
11693 int drive;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11694 HTREEITEM items[26];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11695 FSINFO volinfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11696
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11697 DosError(FERR_DISABLEHARDERR);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11698
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11699 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11700 for(drive=0;drive<26;drive++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11701 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11702 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
11703 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11704 char folder[5] = "C:\\", name[9] = "Drive C:";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11705 HTREEITEM tempitem;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11706
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11707 folder[0] = name[6] = 'A' + drive;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11708
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11709 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
11710 tempitem = dw_tree_insert(tree, "", 0, items[drive], 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11711 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
11712 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11713 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11714 items[drive] = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11715 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11716 dw_mutex_unlock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11717
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11718 DosError(FERR_ENABLEHARDERR);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11719 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11720
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11721 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
11722 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11723 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11724 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
11725 void *treedata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11726
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11727 window = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11728 if(!dwwait)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11729 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11730
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11731 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11732 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
11733 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11734 dw_window_destroy((HWND)dwwait->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11735 dw_dialog_dismiss((DWDialog *)data, treedata);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11736 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11737 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11738
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11739 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
11740 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11741 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11742 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
11743
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11744 window = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11745 if(!dwwait)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11746 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11747
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11748 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11749 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11750 dw_window_destroy((HWND)dwwait->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11751 dw_dialog_dismiss((DWDialog *)data, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11752 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11753 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11754
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
11755 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
11756 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11757 char *folder=strdup("");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11758 HTREEITEM parent = item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11759
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11760 while(parent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11761 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11762 char *temp, *text = dw_tree_get_title(tree, parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11763
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11764 if(text)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11765 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11766 if(strncmp(text, "Drive ", 6) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11767 text = &text[6];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11768
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11769 temp = malloc(strlen(text) + strlen(folder) + 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11770 strcpy(temp, text);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11771 strcat(temp, "\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11772 strcat(temp, folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11773 free(folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11774 folder = temp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11775 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11776 parent = dw_tree_get_parent(tree, parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11777 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11778 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
11779 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
11780
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11781 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
11782 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11783 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11784 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
11785
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11786 text = text; itemdata = itemdata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11787 if(treedata)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11788 free(treedata);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11789
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11790 treedata = _tree_folder(window, item);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11791 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
11792
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11793 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11794 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
11795
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
11796 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
11797 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11798 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
11799
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11800 data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11801 if(tempitem)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11802 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11803 char *folder = _tree_folder(window, item);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11804
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11805 dw_tree_item_set_data(window, item, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11806 dw_tree_item_delete(window, tempitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11807
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11808 if(*folder)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11809 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11810 strcat(folder, "*");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11811 _populate_directory(window, item, folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11812 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11813 free(folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11814 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11815
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11816 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
11817 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
11818
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11819 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11820 * Opens a file dialog and queries user selection.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11821 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11822 * title: Title bar text for dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11823 * defpath: The default path of the open dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11824 * ext: Default file extention.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11825 * flags: DW_FILE_OPEN or DW_FILE_SAVE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11826 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11827 * NULL on error. A malloced buffer containing
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11828 * the file path on success.
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
11829 *
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11830 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11831 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11832 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11833 if(flags == DW_DIRECTORY_OPEN)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11834 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11835 HWND window, hbox, vbox, tree, button;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11836 DWDialog *dwwait;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11837 HMTX mtx = dw_mutex_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11838
1483
73f2ad84d4ec Fixed OS/2 windows being shown when setting position/size.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1473
diff changeset
11839 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
11840
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11841 vbox = dw_box_new(DW_VERT, 5);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11842
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11843 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
11844
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11845 tree = dw_tree_new(60);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11846
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11847 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
11848 dw_window_set_data(window, "_dw_mutex", (void *)mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11849 dw_window_set_data(window, "_dw_tree", (void *)tree);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11850
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11851 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11852
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11853 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
11854
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11855 dwwait = dw_dialog_new((void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11856
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11857 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
11858 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
11859
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11860 button = dw_button_new("Ok", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11861 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
11862 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
11863
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11864 button = dw_button_new("Cancel", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11865 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
11866 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
11867 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
11868
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11869 dw_window_set_size(window, 225, 300);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11870 dw_window_show(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11871
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11872 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
11873 return (char *)dw_dialog_wait(dwwait);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11874 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11875 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11876 {
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11877 FILEDLG fild = { 0 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11878 HWND hwndFile;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11879 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
11880 struct stat buf;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11881
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11882 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
11883 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11884 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
11885 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
11886 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11887
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11888 len = strlen(fild.szFullFile);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11889
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11890 /* If we have a defpath */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11891 if(len)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11892 {
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11893 /* 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
11894 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
11895 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11896 /* 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
11897 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
11898 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11899 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
11900 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
11901 /* 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
11902 len = 0;
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11903 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11904 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11905 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11906
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11907 /* 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
11908 if(!len)
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11909 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11910 /* 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
11911 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
11912
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11913 /* 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
11914 if(ext)
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11915 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11916 /* 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
11917 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
11918 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
11919 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11920 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11921
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
11922 /* Setup the structure */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11923 fild.cbSize = sizeof(FILEDLG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11924 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
11925 fild.pszTitle = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11926 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
11927 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11928
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11929 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11930 if(hwndFile)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11931 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11932 switch(fild.lReturn)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11933 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11934 case DID_OK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11935 return strdup(fild.szFullFile);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11936 case DID_CANCEL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11937 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11938 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11939 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11940 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11941 return NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11942 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11943
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11944 /* 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
11945 int _SetPath(char *path)
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11946 {
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11947 #ifndef __WATCOMC__
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11948 if(strlen(path) > 2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11949 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11950 if(path[1] == ':')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11951 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11952 char drive = toupper(path[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11953 _chdrive((drive - 'A')+1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11954 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11955 }
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
11956 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11957 return chdir(path);
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11958 }
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
11959
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11960 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11961 * Execute and external program in a seperate session.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11962 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11963 * program: Program name with optional path.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11964 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11965 * params: An array of pointers to string arguements.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11966 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11967 * -1 on error.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11968 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11969 int API dw_exec(char *program, int type, char **params)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11970 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11971 type = type; /* keep compiler happy */
1692
6e26c9ead2fe Fixed a variety of warnings in different compiler/linker combinations on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1691
diff changeset
11972 #ifdef __EMX__
1364
417866ad960b Fixes for compiling with Watcom on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1361
diff changeset
11973 return spawnvp(P_NOWAIT, program, (char * const *)params);
1692
6e26c9ead2fe Fixed a variety of warnings in different compiler/linker combinations on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1691
diff changeset
11974 #else
6e26c9ead2fe Fixed a variety of warnings in different compiler/linker combinations on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1691
diff changeset
11975 return spawnvp(P_NOWAIT, program, (const char * const *)params);
6e26c9ead2fe Fixed a variety of warnings in different compiler/linker combinations on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1691
diff changeset
11976 #endif
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11977 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11978
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11979 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11980 * Loads a web browser pointed at the given URL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11981 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11982 * url: Uniform resource locator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11983 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11984 int API dw_browse(char *url)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11985 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11986 char *execargs[3], browser[1024], *olddir, *newurl = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11987 int len, ret;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11988
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11989 olddir = _getcwd(NULL, 1024);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11990
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11991 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
11992 (PSZ)"DefaultWorkingDir", NULL, (PSZ)browser, 1024);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11993
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11994 if(browser[0])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11995 _SetPath(browser);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11996
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11997 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
11998 (PSZ)"DefaultBrowserExe", NULL, (PSZ)browser, 1024);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11999
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12000 len = strlen(browser) - strlen("explore.exe");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12001
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12002 execargs[0] = browser;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12003 execargs[1] = url;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12004 execargs[2] = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12005
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12006 /* Special case for Web Explorer, it requires file:/// instead
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12007 * of file:// so I am handling it here.
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(len > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12010 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12011 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
12012 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12013 int newlen, z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12014 newurl = malloc(strlen(url) + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12015 sprintf(newurl, "file:///%s", &url[7]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12016 newlen = strlen(newurl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12017 for(z=8;z<(newlen-8);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12018 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12019 if(newurl[z] == '|')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12020 newurl[z] = ':';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12021 if(newurl[z] == '/')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12022 newurl[z] = '\\';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12023 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12024 execargs[1] = newurl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12025 }
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
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12028 ret = dw_exec(browser, DW_EXEC_GUI, execargs);
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 if(olddir)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12031 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12032 _SetPath(olddir);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12033 free(olddir);
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(newurl)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12036 free(newurl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12037 return ret;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12038 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12039
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12040 /*
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12041 * 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
12042 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12043 * 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
12044 * 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
12045 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12046 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
12047 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12048 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12049 action = action;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12050 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12051
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12052 /*
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12053 * 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
12054 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12055 * 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
12056 * 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
12057 * be rendered.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12058 * Returns:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12059 * 0 on success.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12060 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12061 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
12062 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12063 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12064 string = string;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12065 return -1;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12066 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12067
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12068 /*
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12069 * 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
12070 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12071 * 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
12072 * 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
12073 * 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
12074 * Returns:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12075 * 0 on success.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12076 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12077 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
12078 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12079 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12080 url = url;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12081 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12082 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12083
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12084 /*
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12085 * Create a new HTML window (widget) to be packed.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12086 * 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
12087 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12088 * 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
12089 * 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
12090 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12091 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
12092 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12093 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
12094 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
12095 return 0;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12096 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12097
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12098 typedef struct _dwprint
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12099 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12100 HDC hdc;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12101 char *printername;
1692
6e26c9ead2fe Fixed a variety of warnings in different compiler/linker combinations on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1691
diff changeset
12102 int (API_FUNC drawfunc)(HPRINT, HPIXMAP, int, void *);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12103 void *drawdata;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12104 unsigned long flags;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12105 unsigned int startpage, endpage;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12106 char *jobname;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12107 } DWPrint;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12108
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12109 /* 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
12110 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
12111 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12112 DWPrint *print = (DWPrint *)data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12113 DWDialog *dwwait = (DWDialog *)print->printername;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12114
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12115 window = (HWND)dwwait->data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12116
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12117 dw_window_destroy(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12118 dw_dialog_dismiss(dwwait, NULL);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12119 return FALSE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12120 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12121
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12122 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
12123 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12124 DWPrint *print = (DWPrint *)data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12125 DWDialog *dwwait = (DWDialog *)print->printername;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12126 HWND printerlist, startspin, endspin;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12127 char *result = NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12128
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12129 window = (HWND)dwwait->data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12130 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
12131 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
12132 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
12133 if(printerlist)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12134 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12135 char printername[32] = "";
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12136 int selected = dw_listbox_selected(printerlist);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12137
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12138 /* 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
12139 if(selected != DW_ERROR_UNKNOWN)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12140 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12141 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
12142 if(printername[0])
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12143 print->printername = result = strdup(printername);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12144 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12145 /* Get the start and end positions */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12146 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
12147 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
12148
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12149 /* 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
12150 if(print->startpage > print->endpage)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12151 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12152 print->endpage = print->startpage;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12153 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
12154 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12155 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12156
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12157 dw_window_destroy(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12158 dw_dialog_dismiss(dwwait, (void *)result);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12159 return FALSE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12160 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12161
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12162 /* 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
12163 BOOL _ExtractLogAddress(char * LogAddress, char * DetailStr)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12164 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12165 char *p;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12166
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12167 p = DetailStr;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12168 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
12169 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
12170 while(*p != ';') *LogAddress++ = *p++;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12171 *LogAddress = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12172 return TRUE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12173 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12174
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12175 BOOL _ExtractDriverName(char * DriverName, char * DetailStr)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12176 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12177 char *p;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12178
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12179 p = DetailStr;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12180 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
12181 while(*p != '.' && *p != ';' && *p != ',')
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12182 *DriverName++ = *p++;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12183 *DriverName = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12184 return TRUE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12185 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12186
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
12187 /* 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
12188 #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
12189 #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
12190 #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
12191
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
12192 /*
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12193 * 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
12194 * Parameters:
1152
58b5374355ab Added print jobname parameter to dw_print_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1150
diff changeset
12195 * 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
12196 * 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
12197 * 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
12198 * 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
12199 * 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
12200 * Returns:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12201 * 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
12202 */
1152
58b5374355ab Added print jobname parameter to dw_print_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1150
diff changeset
12203 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
12204 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12205 char printername[32], tmpbuf[20];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12206 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
12207 DWDialog *dwwait;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12208 DWPrint *print;
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12209 PVOID pBuf = NULL;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12210 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
12211 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
12212 SPLERR splerr = 0 ;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12213 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
12214 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
12215
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12216 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
12217 return NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12218
1692
6e26c9ead2fe Fixed a variety of warnings in different compiler/linker combinations on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1691
diff changeset
12219 print->drawfunc = (int (API_FUNC)(HPRINT, HPIXMAP, int, void *))drawfunc;
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12220 print->drawdata = drawdata;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12221 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
12222 print->startpage = 1;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12223 print->endpage = pages;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12224 print->flags = flags;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12225
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12226 /* 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
12227 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
12228
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12229 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
12230 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12231 /* 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
12232 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
12233
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12234 /* 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
12235 cbBuf = cbNeeded;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12236
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12237 /* 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
12238 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
12239 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12240
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12241 /* 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
12242 if(cb > 2)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12243 printername[cb-2] = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12244 else
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12245 printername[0] = '\0';
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12246
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12247 /* 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
12248 if(!cRes && !printername[0])
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12249 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12250 /* Show an error and return failure */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12251 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
12252 free(print);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12253 return NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12254 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12255
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12256 /* 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
12257 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
12258
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12259 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
12260
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12261 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
12262
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12263 printerlist = dw_listbox_new(0, FALSE);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12264 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
12265
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12266 /* 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
12267 if(pBuf && cRes)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12268 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12269 int count = 0;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12270
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12271 pRes = (PPRINTERINFO)pBuf ;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12272 while(cRes--)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12273 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
12274 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
12275 /* 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
12276 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
12277 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
12278 count++;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12279 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12280 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12281 else
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12282 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12283 /* 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
12284 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
12285 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
12286 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12287
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12288 /* 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
12289 if(pBuf)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
12290 DosFreeMem(pBuf);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12291
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12292 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
12293
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12294 /* Start spinbutton */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12295 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
12296
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12297 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
12298
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12299 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
12300 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
12301 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
12302
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12303 button = dw_spinbutton_new("1", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12304 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
12305 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
12306 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
12307
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12308 /* End spinbutton */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12309 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
12310
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12311 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
12312
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12313 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
12314 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
12315 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
12316
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12317 sprintf(tmpbuf, "%d", pages);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12318 button = dw_spinbutton_new(tmpbuf, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12319 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
12320 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
12321 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
12322
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12323 /* Ok and Cancel buttons */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12324 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
12325
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12326 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
12327 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
12328
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12329 button = dw_button_new("Ok", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12330 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
12331
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12332 dwwait = dw_dialog_new((void *)window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12333 /* 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
12334 print->printername = (char *)dwwait;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12335
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12336 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
12337
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12338 button = dw_button_new("Cancel", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12339 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
12340
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12341 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
12342 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
12343
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12344 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
12345
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12346 dw_window_show(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12347
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12348 print->printername = dw_dialog_wait(dwwait);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12349
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12350 /* The user picked a printer */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12351 if(print->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12352 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12353 char PrintDetails[256];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12354 char DriverName[32];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12355 char LogAddress[32];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12356 DEVOPENSTRUC dop;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12357
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12358 /* 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
12359 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
12360 _ExtractLogAddress(LogAddress, PrintDetails);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12361 _ExtractDriverName(DriverName, PrintDetails);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
12362 dop.pszDriverName = (PSZ)DriverName;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
12363 dop.pszLogAddress = (PSZ)LogAddress;
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12364 dop.pdriv = NULL;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
12365 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
12366 /* 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
12367 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
12368 if(print->hdc)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12369 return print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12370 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12371 /* The user canceled */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12372 if(print->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12373 free(print->printername);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12374 free(print);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12375 return NULL;
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12376 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12377
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12378 /*
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12379 * 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
12380 * Parameters:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12381 * 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
12382 * 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
12383 * Returns:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12384 * 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
12385 */
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12386 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
12387 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12388 DWPrint *p = print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12389 HPIXMAP pixmap;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12390 int x, result = DW_ERROR_UNKNOWN;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12391 SIZEL sizl = { 0, 0 };
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12392
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12393 if(!p)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12394 return result;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12395
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12396 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
12397 return result;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12398
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12399 /* Start the job */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
12400 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
12401
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
12402 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
12403 pixmap->hdc = p->hdc;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12404 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
12405 pixmap->transcolor = DW_RGB_TRANSPARENT;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12406 pixmap->width = sizl.cx;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12407 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
12408 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
12409
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12410 /* Cycle through each page */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12411 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
12412 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12413 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
12414 /* Next page */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12415 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
12416 }
1183
0f85796c6988 Fix calling convention of print callback on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1182
diff changeset
12417 /* Determine the completion code */
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12418 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
12419 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12420 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
12421 /* 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
12422 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
12423 }
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
12424 else
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
12425 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
12426 /* Free memory */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12427 dw_pixmap_destroy(pixmap);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12428 if(p->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12429 free(p->printername);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12430 free(p);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12431 return result;
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12432 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12433
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12434 /*
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12435 * 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
12436 * Parameters:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12437 * 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
12438 */
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12439 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
12440 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12441 DWPrint *p = print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12442
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12443 if(p)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
12444 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
12445 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12446
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
12447 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12448 * Returns a pointer to a static buffer which containes the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12449 * current user directory. Or the root directory (C:\ on
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12450 * OS/2 and Windows).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12451 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12452 char * API dw_user_dir(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12453 {
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
12454 static char _user_dir[MAX_PATH+1] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12455
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12456 if(!_user_dir[0])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12457 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12458 char *home = getenv("HOME");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12459
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12460 if(home)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12461 strcpy(_user_dir, home);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12462 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12463 strcpy(_user_dir, "C:\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12464 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12465 return _user_dir;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12466 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12467
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12468 /*
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
12469 * 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
12470 * 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
12471 */
1384
156e32814c83 Cleanup of the previous commits and added Unix support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1382
diff changeset
12472 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
12473 {
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
12474 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
12475 }
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
12476
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
12477 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12478 * Call a function from the window (widget)'s context.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12479 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12480 * handle: Window handle of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12481 * function: Function pointer to be called.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12482 * data: Pointer to the data to be passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12483 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12484 void API dw_window_function(HWND handle, void *function, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12485 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12486 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12487 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12488
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12489 /* 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
12490 * 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
12491 * 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
12492 */
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
12493 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
12494 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12495 UserData *tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12496
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12497 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12498 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12499 if(stricmp(tmp->varname, varname) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12500 return tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12501 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12502 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12503 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
12504 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12505
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
12506 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
12507 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12508 UserData *new = _find_userdata(root, varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12509
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12510 if(new)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12511 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12512 new->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12513 return TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12514 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12515 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12516 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12517 new = malloc(sizeof(UserData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12518 if(new)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12519 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12520 new->varname = strdup(varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12521 new->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12522
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12523 new->next = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12524
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12525 if (!*root)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12526 *root = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12527 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12528 {
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
12529 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
12530
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12531 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12532 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12533 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12534 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12535 }
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
12536 prev->next = new;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12537 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12538 return TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12539 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12540 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12541 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
12542 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12543
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
12544 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
12545 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12546 UserData *prev = NULL, *tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12547
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12548 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12549 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12550 if(all || stricmp(tmp->varname, varname) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12551 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12552 if(!prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12553 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12554 *root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12555 free(tmp->varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12556 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12557 if(!all)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12558 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12559 tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12560 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12561 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12562 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12563 /* If all is true we should
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12564 * never get here.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12565 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12566 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12567 free(tmp->varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12568 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12569 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12570 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12571 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12572 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12573 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12574 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12575 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12576 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12577 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12578 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
12579 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12580
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12581 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12582 * 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
12583 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12584 * 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
12585 * 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
12586 * 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
12587 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12588 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
12589 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12590 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12591
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12592 if(!blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12593 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12594 if(!dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12595 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12596
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12597 blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12598 WinSetWindowPtr(window, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12599 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12600
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12601 if(data)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12602 _new_userdata(&(blah->root), dataname, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12603 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12604 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12605 if(dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12606 _remove_userdata(&(blah->root), dataname, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12607 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12608 _remove_userdata(&(blah->root), NULL, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12609 }
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12610 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12611
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12612 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12613 * 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
12614 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12615 * 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
12616 * 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
12617 * 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
12618 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
12619 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
12620 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12621 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12622
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12623 if(blah && blah->root && dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12624 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12625 UserData *ud = _find_userdata(&(blah->root), dataname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12626 if(ud)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12627 return ud->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12628 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12629 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
12630 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
12631
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12632 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12633 * 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
12634 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12635 * 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
12636 * 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
12637 * 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
12638 * Returns:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12639 * 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
12640 */
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
12641 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
12642 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12643 if(sigfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12644 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12645 int timerid = WinStartTimer(dwhab, NULLHANDLE, 0, interval);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12646
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12647 if(timerid)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12648 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12649 _new_signal(WM_TIMER, NULLHANDLE, timerid, sigfunc, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12650 return timerid;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12651 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12652 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12653 return 0;
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12654 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12655
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12656 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12657 * Removes timer callback.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12658 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12659 * 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
12660 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12661 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
12662 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12663 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12664
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12665 /* 0 is an invalid timer ID */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12666 if(!id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12667 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12668
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12669 WinStopTimer(dwhab, NULLHANDLE, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12670
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12671 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12672 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12673 if(tmp->id == id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12674 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12675 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12676 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12677 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12678 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12679 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12680 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12681 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12682 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12683 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12684 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12685 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12686 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12687 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12688 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12689 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12690 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12691 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12692 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12693 }
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12694 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12695
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
12696 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12697 * Add a callback to a window event.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12698 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12699 * window: Window handle of signal to be called back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12700 * signame: A string pointer identifying which signal to be hooked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12701 * sigfunc: The pointer to the function to be used as the callback.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12702 * data: User data to be passed to the handler function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12703 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12704 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12705 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12706 ULONG message = 0, id = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12707
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12708 if(window && signame && sigfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12709 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12710 if((message = _findsigmessage(signame)) != 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12711 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12712 /* Handle special case of the menu item */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12713 if(message == WM_COMMAND && window < 65536)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12714 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12715 char buffer[15];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12716 HWND owner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12717
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12718 sprintf(buffer, "_dw_id%d", (int)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12719 owner = (HWND)dw_window_get_data(hwndApp, buffer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12720
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
12721 /* 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
12722 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
12723
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12724 if(owner)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12725 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12726 id = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12727 window = owner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12728 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12729 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12730 _new_signal(message, window, id, sigfunc, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12731 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12732 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12733 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12734
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12735 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12736 * Removes callbacks for a given window with given name.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12737 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12738 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12739 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12740 void API dw_signal_disconnect_by_name(HWND window, char *signame)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12741 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12742 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12743 ULONG message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12744
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12745 if(!window || !signame || (message = _findsigmessage(signame)) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12746 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12747
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12748 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12749 {
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
12750 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
12751 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12752 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12753 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12754 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12755 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12756 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12757 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12758 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12759 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12760 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12761 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12762 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12763 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12764 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12765 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12766 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12767 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12768 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12769 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12770 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12771 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12772
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12773 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12774 * Removes all callbacks for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12775 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12776 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12777 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12778 void API dw_signal_disconnect_by_window(HWND window)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12779 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12780 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12781
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12782 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12783 {
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
12784 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
12785 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12786 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12787 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12788 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12789 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12790 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12791 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12792 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12793 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12794 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12795 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12796 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12797 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12798 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12799 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12800 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12801 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12802 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12803 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12804 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12805 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12806
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12807 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12808 * Removes all callbacks for a given window with specified data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12809 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12810 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12811 * data: Pointer to the data to be compared against.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12812 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
12813 void API dw_signal_disconnect_by_data(HWND window, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12814 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12815 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12816
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12817 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12818 {
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
12819 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
12820 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12821 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12822 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12823 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12824 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12825 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12826 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12827 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12828 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12829 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12830 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12831 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12832 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12833 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12834 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12835 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12836 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12837 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12838 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12839 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12840 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12841
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
12842 /*
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
12843 * 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
12844 * Parameters:
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
12845 * 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
12846 * 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
12847 * 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
12848 */
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
12849 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
12850 {
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
12851 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
12852 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
12853 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
12854 (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
12855 NULL,
1534
ad8181f70f31 Add a separate class for the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1531
diff changeset
12856 WS_VISIBLE,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12857 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12858 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12859 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12860 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12861 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
12862 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
12863 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
12864 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
12865 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
12866 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
12867 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
12868 }
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
12869
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12870 /*
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
12871 * 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
12872 * 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
12873 * 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
12874 * 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
12875 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12876 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
12877 {
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12878 /* 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
12879 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
12880 year--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12881 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
12882 month--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12883 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
12884 day--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12885
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12886 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
12887 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
12888 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
12889 /* 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
12890 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
12891 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12892
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
12893 /*
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
12894 * 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
12895 * 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
12896 * 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
12897 * 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
12898 * 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
12899 * 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
12900 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
12901 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
12902 {
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
12903 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
12904 *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
12905 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
12906 *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
12907 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
12908 *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
12909 }