Mercurial > dwindows
annotate dwtest.c @ 266:5c5bee286d0e
Fixed some warnings.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 28 Feb 2003 01:32:32 +0000 |
parents | 9ea4ac9a097f |
children | bf8b907f8a29 |
rev | line source |
---|---|
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1 #include <stdlib.h> |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2 #include <string.h> |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3 #include <stdio.h> |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4 #include "dw.h" |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5 |
219
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
6 /* Select a fixed width font for our platform */ |
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
7 #ifdef __OS2__ |
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
8 #define FIXEDFONT "5.System VIO" |
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
9 #elif defined(__WIN32__) |
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
10 #define FIXEDFONT "10.Terminal" |
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
11 #elif GTK_MAJOR_VERSION > 1 |
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
12 #define FIXEDFONT "monospace 10" |
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
13 #else |
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
14 #define FIXEDFONT "fixed" |
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
15 #endif |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
16 |
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:
254
diff
changeset
|
17 #define SCROLLBARWIDTH 14 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
254
diff
changeset
|
18 |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
19 unsigned long flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
20 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
21 |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
22 HWND mainwindow, |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
23 entryfield, |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
24 okbutton, |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
25 cancelbutton, |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
26 lbbox, |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
27 notebookbox, |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
28 notebookbox1, |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
29 notebookbox2, |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
30 notebookbox3, |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
31 notebook, |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
32 vscrollbar, |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
33 hscrollbar, |
206
f7911991c5df
Show info about the scrollbar in a status text control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
34 status, |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
35 stext, |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
36 tree, |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
37 pagebox, |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
38 treebox, |
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:
254
diff
changeset
|
39 textbox1, textbox2, textboxA, |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
40 gap_box, |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
41 buttonbox; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
42 |
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:
254
diff
changeset
|
43 HPIXMAP text1pm,text2pm; |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
44 |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
45 int font_width = 8; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
46 int font_height=12; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
47 int font_gap = 2; |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
48 int rows=100,width1=6,cols=80; |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
49 char *current_file = NULL; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
50 int timerid; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
51 int num_lines=0; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
52 int max_linewidth=0; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
53 int current_row=0,current_col=0; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
54 |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
55 FILE *fp=NULL; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
56 char **lp; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
57 |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
58 /* This gets called when a part of the graph needs to be repainted. */ |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
59 int DWSIGNAL text_expose(HWND hwnd, DWExpose *exp, void *data) |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
60 { |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
61 HPIXMAP hpm; |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
62 int width,height; |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
63 |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
64 if ( hwnd == textbox1 ) |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
65 hpm = text1pm; |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
66 else if ( hwnd == textbox2 ) |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
67 hpm = text2pm; |
266
5c5bee286d0e
Fixed some warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
68 else |
5c5bee286d0e
Fixed some warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
69 return TRUE; |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
70 |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
71 width = DW_PIXMAP_WIDTH(hpm); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
72 height = DW_PIXMAP_HEIGHT(hpm); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
73 |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
74 dw_pixmap_bitblt(hwnd, NULL, 0, 0, width, height, NULL, hpm, 0, 0 ); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
75 dw_flush(); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
76 return TRUE; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
77 } |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
78 |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
79 void read_file( void ) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
80 { |
219
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
81 int i,len; |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
82 fp = fopen( current_file, "r" ); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
83 lp = (char **)calloc( 1000,sizeof(char *)); |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
84 /* should test for out of memory */ |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
85 max_linewidth=0; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
86 for ( i = 0; i < 1000; i++ ) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
87 { |
227
5e6d8e024214
Use calloc instead of malloc so line buffers aren't filled with garbage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
226
diff
changeset
|
88 lp[i] = (char *)calloc(1, 1025); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
89 if ( fgets( lp[i], 1024, fp ) == NULL ) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
90 break; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
91 len = strlen( lp[i] ); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
92 if ( len > max_linewidth ) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
93 max_linewidth = len; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
94 if ( lp[i][len - 1] == '\n' ) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
95 lp[i][len - 1] = '\0'; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
96 } |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
97 num_lines = i; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
98 fclose( fp ); |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
99 dw_scrollbar_set_range(hscrollbar, max_linewidth, cols); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
100 dw_scrollbar_set_pos(hscrollbar, 0); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
101 dw_scrollbar_set_range(vscrollbar, num_lines, rows); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
102 dw_scrollbar_set_pos(vscrollbar, 0); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
103 } |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
104 |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
105 void draw_file( int row, int col ) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
106 { |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
107 char buf[10]; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
108 int i,y; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
109 char *pLine; |
226
2aee0b23e880
Removed unnecessary fprintf() statements.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
225
diff
changeset
|
110 |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
111 if ( current_file ) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
112 { |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
113 dw_color_foreground_set(DW_CLR_WHITE); |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
114 dw_draw_rect(0, text1pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text1pm), DW_PIXMAP_HEIGHT(text1pm)); |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
115 dw_draw_rect(0, text2pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text2pm), DW_PIXMAP_HEIGHT(text2pm)); |
229
4166c18586e5
Fixed number of lines calculation in configure_event() taking into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
227
diff
changeset
|
116 for ( i = 0;(i < rows) && (i+row < num_lines); i++) |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
117 { |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
118 y = i*(font_height+font_gap); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
119 dw_color_foreground_set( i ); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
120 sprintf( buf, "%6.6d", i+row ); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
121 dw_draw_text( NULL, text1pm, 0, y, buf); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
122 pLine = lp[i+row]; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
123 dw_draw_text( NULL, text2pm, 0, y, pLine+col ); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
124 } |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
125 text_expose( textbox1, NULL, NULL); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
126 text_expose( textbox2, NULL, NULL); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
127 } |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
128 } |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
129 |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
130 int DWSIGNAL beep_callback(HWND window, void *data) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
131 { |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
132 dw_timer_disconnect( timerid ); |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
133 return TRUE; |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
134 } |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
135 |
266
5c5bee286d0e
Fixed some warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
136 int DWSIGNAL keypress_callback(HWND window, char *text, void *data) |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
137 { |
266
5c5bee286d0e
Fixed some warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
138 fprintf(stderr,"got keypress\n"); |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
139 return 0; |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
140 } |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
141 |
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:
191
diff
changeset
|
142 int DWSIGNAL exit_callback(HWND window, void *data) |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
143 { |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
144 dw_window_destroy((HWND)data); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
145 exit(0); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
146 return -1; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
147 } |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
148 |
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:
191
diff
changeset
|
149 int DWSIGNAL test_callback(HWND window, void *data) |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
150 { |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
151 dw_window_destroy((HWND)data); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
152 if ( current_file ) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
153 dw_free( current_file ); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
154 exit(0); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
155 return -1; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
156 } |
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:
191
diff
changeset
|
157 |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
191
diff
changeset
|
158 int DWSIGNAL browse_callback(HWND window, void *data) |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
159 { |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
160 char *tmp; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
161 tmp = dw_file_browse("test string", NULL, "c", DW_FILE_OPEN ); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
162 if ( tmp ) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
163 { |
231
a3775f5b877f
Only free current_file when we have a new file selected to show.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
229
diff
changeset
|
164 if ( current_file ) |
a3775f5b877f
Only free current_file when we have a new file selected to show.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
229
diff
changeset
|
165 { |
a3775f5b877f
Only free current_file when we have a new file selected to show.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
229
diff
changeset
|
166 dw_free( current_file ); |
a3775f5b877f
Only free current_file when we have a new file selected to show.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
229
diff
changeset
|
167 } |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
168 current_file = tmp; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
169 dw_window_set_text( entryfield, current_file ); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
170 read_file(); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
171 draw_file(0,0); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
172 } |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
173 return 0; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
174 } |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
175 |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
176 /* Callback to handle user selection of the scrollbar position */ |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
177 void DWSIGNAL scrollbar_valuechanged(HWND hwnd, int value, void *data) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
178 { |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
179 if(data) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
180 { |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
181 HWND stext = (HWND)data; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
182 char tmpbuf[100]; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
183 if ( hwnd == vscrollbar ) |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
184 { |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
185 current_row = value; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
186 } |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
187 else |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
188 { |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
189 current_col = value; |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
190 } |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
191 sprintf(tmpbuf, "Row:%d Col:%d Lines:%d Cols:%d", current_row,current_col,num_lines,max_linewidth); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
192 dw_window_set_text(stext, tmpbuf); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
193 draw_file( current_row, current_col); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
194 } |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
195 } |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
196 |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
197 /* Handle size change of the main render window */ |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
198 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data) |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
199 { |
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:
254
diff
changeset
|
200 HPIXMAP old1 = text1pm, old2 = text2pm; |
222
7bb6cb6f612c
Another minor change... create the first pixmap to the correct window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
221
diff
changeset
|
201 int depth = dw_color_depth(); |
7bb6cb6f612c
Another minor change... create the first pixmap to the correct window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
221
diff
changeset
|
202 |
229
4166c18586e5
Fixed number of lines calculation in configure_event() taking into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
227
diff
changeset
|
203 rows = height / (font_height+font_gap); |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
204 cols = width / font_width; |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
205 |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
206 /* Create new pixmaps with the current sizes */ |
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:
254
diff
changeset
|
207 text1pm = dw_pixmap_new(textbox1, (font_width*(width1+1)), height+1, depth); |
222
7bb6cb6f612c
Another minor change... create the first pixmap to the correct window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
221
diff
changeset
|
208 text2pm = dw_pixmap_new(textbox2, width, height, depth); |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
209 |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
210 /* Destroy the old pixmaps */ |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
211 dw_pixmap_destroy(old1); |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
212 dw_pixmap_destroy(old2); |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
213 |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
214 /* Update scrollbar ranges with new values */ |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
215 dw_scrollbar_set_range(hscrollbar, max_linewidth, cols); |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
216 dw_scrollbar_set_range(vscrollbar, num_lines, rows); |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
217 |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
218 /* Redraw the window */ |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
219 draw_file( current_row, current_col); |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
220 return TRUE; |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
221 } |
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
222 |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
223 void archive_add(void) |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
224 { |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
225 HWND browsebutton, browsebox; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
226 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
227 lbbox = dw_box_new(BOXVERT, 10); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
228 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
229 dw_box_pack_start(notebookbox1, lbbox, 150, 70, TRUE, TRUE, 0); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
230 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
231 /* Archive Name */ |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
232 stext = dw_text_new("File to browse", 0); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
233 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
234 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
235 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
236 dw_box_pack_start(lbbox, stext, 130, 15, TRUE, TRUE, 2); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
237 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
238 browsebox = dw_box_new(BOXHORZ, 0); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
239 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
240 dw_box_pack_start(lbbox, browsebox, 0, 0, TRUE, TRUE, 0); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
241 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
242 entryfield = dw_entryfield_new("", 100L); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
243 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
244 dw_box_pack_start(browsebox, entryfield, 100, 15, TRUE, TRUE, 4); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
245 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
246 browsebutton = dw_button_new("Browse", 1001L); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
247 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
248 dw_box_pack_start(browsebox, browsebutton, 30, 15, TRUE, TRUE, 0); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
249 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
250 dw_window_set_color(browsebox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
251 dw_window_set_color(stext, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
252 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
253 /* Buttons */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
254 buttonbox = dw_box_new(BOXHORZ, 10); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
255 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
256 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
257 |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
258 okbutton = dw_button_new("Turn Off Annoying Beep!", 1001L); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
259 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
260 dw_box_pack_start(buttonbox, okbutton, 130, 30, TRUE, TRUE, 2); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
261 |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
262 cancelbutton = dw_button_new("Exit", 1002L); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
263 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
264 dw_box_pack_start(buttonbox, cancelbutton, 130, 30, TRUE, TRUE, 2); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
265 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
266 /* Set some nice fonts and colors */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
267 dw_window_set_color(lbbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
268 dw_window_set_color(buttonbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
269 dw_window_set_color(okbutton, DW_CLR_PALEGRAY, DW_CLR_DARKCYAN); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
270 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
271 dw_signal_connect(browsebutton, "clicked", DW_SIGNAL_FUNC(browse_callback), (void *)notebookbox1); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
272 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(beep_callback), (void *)notebookbox1); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
273 dw_signal_connect(cancelbutton, "clicked", DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
274 } |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
275 |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
276 |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
277 void text_add(void) |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
278 { |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
279 int depth = dw_color_depth(); |
252
eab1540444b2
Make an empty space where the scrollbars meet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
232
diff
changeset
|
280 HWND vscrollbox; |
213
f8b50901ac45
Added verticle scrollbar test to the sample.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
207
diff
changeset
|
281 |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
282 /* create a box to pack into the notebook page */ |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
283 pagebox = dw_box_new(BOXHORZ, 2); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
284 dw_box_pack_start( notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
285 /* now a status area under this box */ |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
286 status = dw_status_text_new("", 0); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
287 dw_box_pack_start( notebookbox2, status, 100, 20, TRUE, FALSE, 1); |
213
f8b50901ac45
Added verticle scrollbar test to the sample.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
207
diff
changeset
|
288 |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
289 /* create render box for number pixmap */ |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
290 textbox1 = dw_render_new( 100 ); |
219
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
291 dw_window_set_font(textbox1, FIXEDFONT); |
221
3fd010a0a33f
Fixed the expose_event with dynamic pixmaps.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
219
diff
changeset
|
292 dw_font_text_extents(textbox1, NULL, "O", &font_width, &font_height); |
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:
254
diff
changeset
|
293 vscrollbox = dw_box_new(BOXVERT, 0); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
254
diff
changeset
|
294 dw_box_pack_start(vscrollbox, textbox1, (font_width*(width1+1)), font_height*rows, FALSE, TRUE, 0); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
254
diff
changeset
|
295 dw_box_pack_start(vscrollbox, 0, (font_width*(width1+1)), SCROLLBARWIDTH, FALSE, FALSE, 0); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
254
diff
changeset
|
296 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
297 |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
298 /* create render box for gap pixmap */ |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
299 /* create box for filecontents and horz scrollbar */ |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
300 textboxA = dw_box_new( BOXVERT,0 ); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
301 dw_box_pack_start( pagebox, textboxA, 0, 0, TRUE, TRUE, 0); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
302 |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
303 /* create render box for filecontents pixmap */ |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
304 textbox2 = dw_render_new( 101 ); |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
305 dw_box_pack_start( textboxA, textbox2, 10, 10, TRUE, TRUE, 0); |
219
79968cf0f3b3
Choose a nice font. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
218
diff
changeset
|
306 dw_window_set_font(textbox2, FIXEDFONT); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
307 /* create horizonal scrollbar */ |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
308 hscrollbar = dw_scrollbar_new(FALSE, 100, 50); |
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:
254
diff
changeset
|
309 dw_box_pack_start( textboxA, hscrollbar, 100, SCROLLBARWIDTH, TRUE, FALSE, 0); |
197
f3718165f0b2
Implemented scrollbars and timers on Windows, and added scrollbar to the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
310 |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
311 /* create vertical scrollbar */ |
252
eab1540444b2
Make an empty space where the scrollbars meet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
232
diff
changeset
|
312 vscrollbox = dw_box_new(BOXVERT, 0); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
313 vscrollbar = dw_scrollbar_new(TRUE, 100, 50); |
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:
254
diff
changeset
|
314 dw_box_pack_start(vscrollbox, vscrollbar, SCROLLBARWIDTH, 100, FALSE, TRUE, 0); |
253
e041ce42659a
Added a comment describing how it works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
252
diff
changeset
|
315 /* Pack an area of empty space 14x14 pixels */ |
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:
254
diff
changeset
|
316 dw_box_pack_start(vscrollbox, 0, SCROLLBARWIDTH, SCROLLBARWIDTH, FALSE, FALSE, 0); |
252
eab1540444b2
Make an empty space where the scrollbars meet.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
232
diff
changeset
|
317 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); |
206
f7911991c5df
Show info about the scrollbar in a status text control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
318 |
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:
254
diff
changeset
|
319 text1pm = dw_pixmap_new( textbox1, (font_width*(width1+1)), font_height*rows, depth ); |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
320 text2pm = dw_pixmap_new( textbox2, font_width*cols, font_height*rows, depth ); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
321 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
322 dw_messagebox("DWTest", "Width: %d Height: %d\n", font_width, font_height); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
323 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows); |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
324 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*cols, font_height*rows); |
221
3fd010a0a33f
Fixed the expose_event with dynamic pixmaps.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
219
diff
changeset
|
325 dw_signal_connect(textbox1, "expose_event", DW_SIGNAL_FUNC(text_expose), NULL); |
3fd010a0a33f
Fixed the expose_event with dynamic pixmaps.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
219
diff
changeset
|
326 dw_signal_connect(textbox2, "expose_event", DW_SIGNAL_FUNC(text_expose), NULL); |
218
fe0ab0040ba2
Not quite right yet but... handle resize and pixmap resizing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
217
diff
changeset
|
327 dw_signal_connect(textbox2, "configure_event", DW_SIGNAL_FUNC(configure_event), text2pm); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
328 dw_signal_connect(hscrollbar, "value_changed", DW_SIGNAL_FUNC(scrollbar_valuechanged), (void *)status); |
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
329 dw_signal_connect(vscrollbar, "value_changed", DW_SIGNAL_FUNC(scrollbar_valuechanged), (void *)status); |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
330 dw_signal_connect(textbox1, "key_press_event", DW_SIGNAL_FUNC(keypress_callback), text1pm); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
331 dw_signal_connect(textbox2, "key_press_event", DW_SIGNAL_FUNC(keypress_callback), text2pm); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
332 } |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
333 |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
334 void tree_add(void) |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
335 { |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
336 HWND t1,t2,t3; |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
337 |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
338 /* create a box to pack into the notebook page */ |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
339 treebox = dw_box_new(BOXHORZ, 2); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
340 dw_box_pack_start( notebookbox3, treebox, 500, 200, TRUE, TRUE, 0); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
341 |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
342 /* now a tree area under this box */ |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
343 tree = dw_tree_new(0); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
344 dw_box_pack_start( notebookbox3, tree, 500, 200, TRUE, FALSE, 1); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
345 |
266
5c5bee286d0e
Fixed some warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
346 t1 = dw_tree_insert(tree, "tree item 1", 0, NULL, NULL ); |
5c5bee286d0e
Fixed some warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
347 t2 = dw_tree_insert(tree, "tree item 2", 0, NULL, NULL ); |
5c5bee286d0e
Fixed some warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
348 t3 = dw_tree_insert(tree, "tree item 3", 0, t2, NULL ); |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
349 |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
350 /* |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
351 dw_signal_connect(textbox1, "expose_event", DW_SIGNAL_FUNC(text_expose), NULL); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
352 dw_signal_connect(textbox2, "expose_event", DW_SIGNAL_FUNC(text_expose), NULL); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
353 dw_signal_connect(textbox2, "configure_event", DW_SIGNAL_FUNC(configure_event), text2pm); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
354 dw_signal_connect(hscrollbar, "value_changed", DW_SIGNAL_FUNC(scrollbar_valuechanged), (void *)status); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
355 dw_signal_connect(vscrollbar, "value_changed", DW_SIGNAL_FUNC(scrollbar_valuechanged), (void *)status); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
356 dw_signal_connect(textbox1, "key_press_event", DW_SIGNAL_FUNC(keypress_callback), text1pm); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
357 dw_signal_connect(textbox2, "key_press_event", DW_SIGNAL_FUNC(keypress_callback), text2pm); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
358 */ |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
359 } |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
360 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
361 /* Beep every second */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
362 int DWSIGNAL timer_callback(void *data) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
363 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
364 dw_beep(200, 200); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
365 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
366 /* Return TRUE so we get called again */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
367 return TRUE; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
368 } |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
369 |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
370 /* |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
371 * Let's demonstrate the functionality of this library. :) |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
372 */ |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
373 int main(int argc, char *argv[]) |
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
374 { |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
375 ULONG notebookpage1; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
376 ULONG notebookpage2; |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
377 ULONG notebookpage3; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
378 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
379 dw_init(TRUE, argc, argv); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
380 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
381 mainwindow = dw_window_new( HWND_DESKTOP, "dwindows test", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX ); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
382 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
383 notebookbox = dw_box_new( BOXVERT, 5 ); |
217
7112c817573d
Added test code from mark hessling.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
213
diff
changeset
|
384 dw_box_pack_start( mainwindow, notebookbox, 0, 0, TRUE, TRUE, 0); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
385 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
386 notebook = dw_notebook_new( 1, TRUE ); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
387 dw_box_pack_start( notebookbox, notebook, 100, 100, TRUE, TRUE, 0); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
388 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
389 notebookbox1 = dw_box_new( BOXVERT, 5 ); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
390 notebookpage1 = dw_notebook_page_new( notebook, 0, TRUE ); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
391 dw_notebook_pack( notebook, notebookpage1, notebookbox1 ); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
392 dw_notebook_page_set_text( notebook, notebookpage1, "first page"); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
393 archive_add(); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
394 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
395 notebookbox2 = dw_box_new( BOXVERT, 5 ); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
396 notebookpage2 = dw_notebook_page_new( notebook, 1, FALSE ); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
397 dw_notebook_pack( notebook, notebookpage2, notebookbox2 ); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
398 dw_notebook_page_set_text( notebook, notebookpage2, "second page"); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
399 text_add(); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
400 |
254
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
401 notebookbox3 = dw_box_new( BOXVERT, 5 ); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
402 notebookpage3 = dw_notebook_page_new( notebook, 1, FALSE ); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
403 dw_notebook_pack( notebook, notebookpage3, notebookbox3 ); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
404 dw_notebook_page_set_text( notebook, notebookpage3, "third page"); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
405 tree_add(); |
42332e598d55
Add third notebook page - for tree example. Just starting.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
253
diff
changeset
|
406 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
407 dw_signal_connect(mainwindow, "delete_event", DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
198
diff
changeset
|
408 timerid = dw_timer_connect(1000, DW_SIGNAL_FUNC(timer_callback), 0); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
409 dw_window_set_usize(mainwindow, 640, 480); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
410 dw_window_show(mainwindow); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
411 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
412 dw_main(); |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
413 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
193
diff
changeset
|
414 return 0; |
191
634625c3239d
Fixes for dw_color_xxxx_set() to accept OS/2 style colors, and fixed a
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
415 } |