comparison dwtest.c @ 954:cfb12bf3bb06

Fixes for some more coordinate system issues on the Mac. Also some changes to the test program to make sure to test for these type issues.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 02 May 2011 01:07:49 +0000
parents ae5d884af4ed
children 8b73a45ae424
comparison
equal deleted inserted replaced
953:2dfc06afc7d3 954:cfb12bf3bb06
28 28
29 #define SCROLLBARWIDTH 14 29 #define SCROLLBARWIDTH 14
30 #define MAX_WIDGETS 20 30 #define MAX_WIDGETS 20
31 31
32 unsigned long flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR | 32 unsigned long flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR |
33 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER; 33 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER;
34 34
35 unsigned long current_color = DW_RGB(100,100,100); 35 unsigned long current_color = DW_RGB(100,100,100);
36 36
37 int iteration = 0; 37 int iteration = 0;
38 void create_button( int); 38 void create_button( int);
39 39
40 HWND mainwindow, 40 HWND mainwindow,
41 entryfield, 41 entryfield,
42 checkable_menuitem, 42 checkable_menuitem,
43 noncheckable_menuitem, 43 noncheckable_menuitem,
44 cursortogglebutton, 44 cursortogglebutton,
45 colorchoosebutton, 45 colorchoosebutton,
46 okbutton, 46 okbutton,
47 cancelbutton, 47 cancelbutton,
48 lbbox, 48 lbbox,
49 combox, 49 combox,
50 combobox1, 50 combobox1,
51 combobox2, 51 combobox2,
52 spinbutton, 52 spinbutton,
53 slider, 53 slider,
54 notebookbox, 54 notebookbox,
55 notebookbox1, 55 notebookbox1,
56 notebookbox2, 56 notebookbox2,
57 notebookbox3, 57 notebookbox3,
58 notebookbox4, 58 notebookbox4,
59 notebookbox5, 59 notebookbox5,
60 notebookbox6, 60 notebookbox6,
61 notebookbox7, 61 notebookbox7,
62 notebookbox8, 62 notebookbox8,
63 html, 63 html,
64 rawhtml, 64 rawhtml,
65 notebook, 65 notebook,
66 vscrollbar, 66 vscrollbar,
67 hscrollbar, 67 hscrollbar,
68 status, 68 status1,
69 container_status, 69 status2,
70 tree_status, 70 rendcombo,
71 stext, 71 container_status,
72 tree, 72 tree_status,
73 container, 73 stext,
74 container_mle, 74 tree,
75 pagebox, 75 container,
76 treebox, 76 container_mle,
77 containerbox, 77 pagebox,
78 textbox1, textbox2, textboxA, 78 treebox,
79 gap_box, 79 containerbox,
80 buttonbox, 80 textbox1, textbox2, textboxA,
81 buttonsbox, 81 gap_box,
82 buttonboxperm, 82 buttonbox,
83 cal, 83 buttonsbox,
84 scrollbox, 84 buttonboxperm,
85 labelarray[MAX_WIDGETS], 85 cal,
86 entryarray[MAX_WIDGETS], 86 scrollbox,
87 filetoolbarbox; 87 labelarray[MAX_WIDGETS],
88 entryarray[MAX_WIDGETS],
89 filetoolbarbox;
88 90
89 HMENUI mainmenubar,changeable_menu; 91 HMENUI mainmenubar,changeable_menu;
90 #define CHECKABLE_MENUITEMID 2001 92 #define CHECKABLE_MENUITEMID 2001
91 #define NONCHECKABLE_MENUITEMID 2002 93 #define NONCHECKABLE_MENUITEMID 2002
92 94
106 int timerid; 108 int timerid;
107 int num_lines=0; 109 int num_lines=0;
108 int max_linewidth=0; 110 int max_linewidth=0;
109 int current_row=0,current_col=0; 111 int current_row=0,current_col=0;
110 int cursor_arrow = 1; 112 int cursor_arrow = 1;
113 int render_type = 0;
111 114
112 FILE *fp=NULL; 115 FILE *fp=NULL;
113 char **lp; 116 char **lp;
114 117
115 char *resolve_keyname( int vk ) 118 char *resolve_keyname( int vk )
116 { 119 {
117 char *keyname; 120 char *keyname;
118 switch(vk) 121 switch(vk)
119 { 122 {
120 case VK_LBUTTON : keyname = "VK_LBUTTON"; break; 123 case VK_LBUTTON : keyname = "VK_LBUTTON"; break;
121 case VK_RBUTTON : keyname = "VK_RBUTTON"; break; 124 case VK_RBUTTON : keyname = "VK_RBUTTON"; break;
122 case VK_CANCEL : keyname = "VK_CANCEL"; break; 125 case VK_CANCEL : keyname = "VK_CANCEL"; break;
123 case VK_MBUTTON : keyname = "VK_MBUTTON"; break; 126 case VK_MBUTTON : keyname = "VK_MBUTTON"; break;
124 /* case VK_BACK : keyname = "VK_BACK"; break;*/ 127 /* case VK_BACK : keyname = "VK_BACK"; break;*/
125 case VK_TAB : keyname = "VK_TAB"; break; 128 case VK_TAB : keyname = "VK_TAB"; break;
126 case VK_CLEAR : keyname = "VK_CLEAR"; break; 129 case VK_CLEAR : keyname = "VK_CLEAR"; break;
127 case VK_RETURN : keyname = "VK_RETURN"; break; 130 case VK_RETURN : keyname = "VK_RETURN"; break;
128 /* case VK_MENU : keyname = "VK_MENU"; break;*/ 131 /* case VK_MENU : keyname = "VK_MENU"; break;*/
129 case VK_PAUSE : keyname = "VK_PAUSE"; break; 132 case VK_PAUSE : keyname = "VK_PAUSE"; break;
130 case VK_CAPITAL : keyname = "VK_CAPITAL"; break; 133 case VK_CAPITAL : keyname = "VK_CAPITAL"; break;
131 case VK_ESCAPE : keyname = "VK_ESCAPE"; break; 134 case VK_ESCAPE : keyname = "VK_ESCAPE"; break;
132 case VK_SPACE : keyname = "VK_SPACE"; break; 135 case VK_SPACE : keyname = "VK_SPACE"; break;
133 case VK_PRIOR : keyname = "VK_PRIOR"; break; 136 case VK_PRIOR : keyname = "VK_PRIOR"; break;
134 case VK_NEXT : keyname = "VK_NEXT"; break; 137 case VK_NEXT : keyname = "VK_NEXT"; break;
135 case VK_END : keyname = "VK_END"; break; 138 case VK_END : keyname = "VK_END"; break;
136 case VK_HOME : keyname = "VK_HOME"; break; 139 case VK_HOME : keyname = "VK_HOME"; break;
137 case VK_LEFT : keyname = "VK_LEFT"; break; 140 case VK_LEFT : keyname = "VK_LEFT"; break;
138 case VK_UP : keyname = "VK_UP"; break; 141 case VK_UP : keyname = "VK_UP"; break;
139 case VK_RIGHT : keyname = "VK_RIGHT"; break; 142 case VK_RIGHT : keyname = "VK_RIGHT"; break;
140 case VK_DOWN : keyname = "VK_DOWN"; break; 143 case VK_DOWN : keyname = "VK_DOWN"; break;
141 case VK_SELECT : keyname = "VK_SELECT"; break; 144 case VK_SELECT : keyname = "VK_SELECT"; break;
142 case VK_PRINT : keyname = "VK_PRINT"; break; 145 case VK_PRINT : keyname = "VK_PRINT"; break;
143 case VK_EXECUTE : keyname = "VK_EXECUTE"; break; 146 case VK_EXECUTE : keyname = "VK_EXECUTE"; break;
144 case VK_SNAPSHOT: keyname = "VK_SNAPSHOT"; break; 147 case VK_SNAPSHOT: keyname = "VK_SNAPSHOT"; break;
145 case VK_INSERT : keyname = "VK_INSERT"; break; 148 case VK_INSERT : keyname = "VK_INSERT"; break;
146 case VK_DELETE : keyname = "VK_DELETE"; break; 149 case VK_DELETE : keyname = "VK_DELETE"; break;
147 case VK_HELP : keyname = "VK_HELP"; break; 150 case VK_HELP : keyname = "VK_HELP"; break;
148 case VK_LWIN : keyname = "VK_LWIN"; break; 151 case VK_LWIN : keyname = "VK_LWIN"; break;
149 case VK_RWIN : keyname = "VK_RWIN"; break; 152 case VK_RWIN : keyname = "VK_RWIN"; break;
150 case VK_NUMPAD0 : keyname = "VK_NUMPAD0"; break; 153 case VK_NUMPAD0 : keyname = "VK_NUMPAD0"; break;
151 case VK_NUMPAD1 : keyname = "VK_NUMPAD1"; break; 154 case VK_NUMPAD1 : keyname = "VK_NUMPAD1"; break;
152 case VK_NUMPAD2 : keyname = "VK_NUMPAD2"; break; 155 case VK_NUMPAD2 : keyname = "VK_NUMPAD2"; break;
153 case VK_NUMPAD3 : keyname = "VK_NUMPAD3"; break; 156 case VK_NUMPAD3 : keyname = "VK_NUMPAD3"; break;
154 case VK_NUMPAD4 : keyname = "VK_NUMPAD4"; break; 157 case VK_NUMPAD4 : keyname = "VK_NUMPAD4"; break;
155 case VK_NUMPAD5 : keyname = "VK_NUMPAD5"; break; 158 case VK_NUMPAD5 : keyname = "VK_NUMPAD5"; break;
156 case VK_NUMPAD6 : keyname = "VK_NUMPAD6"; break; 159 case VK_NUMPAD6 : keyname = "VK_NUMPAD6"; break;
157 case VK_NUMPAD7 : keyname = "VK_NUMPAD7"; break; 160 case VK_NUMPAD7 : keyname = "VK_NUMPAD7"; break;
158 case VK_NUMPAD8 : keyname = "VK_NUMPAD8"; break; 161 case VK_NUMPAD8 : keyname = "VK_NUMPAD8"; break;
159 case VK_NUMPAD9 : keyname = "VK_NUMPAD9"; break; 162 case VK_NUMPAD9 : keyname = "VK_NUMPAD9"; break;
160 case VK_MULTIPLY: keyname = "VK_MULTIPLY"; break; 163 case VK_MULTIPLY: keyname = "VK_MULTIPLY"; break;
161 case VK_ADD : keyname = "VK_ADD"; break; 164 case VK_ADD : keyname = "VK_ADD"; break;
162 case VK_SEPARATOR: keyname = "VK_SEPARATOR"; break; 165 case VK_SEPARATOR: keyname = "VK_SEPARATOR"; break;
163 case VK_SUBTRACT: keyname = "VK_SUBTRACT"; break; 166 case VK_SUBTRACT: keyname = "VK_SUBTRACT"; break;
164 case VK_DECIMAL : keyname = "VK_DECIMAL"; break; 167 case VK_DECIMAL : keyname = "VK_DECIMAL"; break;
165 case VK_DIVIDE : keyname = "VK_DIVIDE"; break; 168 case VK_DIVIDE : keyname = "VK_DIVIDE"; break;
166 case VK_F1 : keyname = "VK_F1"; break; 169 case VK_F1 : keyname = "VK_F1"; break;
167 case VK_F2 : keyname = "VK_F2"; break; 170 case VK_F2 : keyname = "VK_F2"; break;
168 case VK_F3 : keyname = "VK_F3"; break; 171 case VK_F3 : keyname = "VK_F3"; break;
169 case VK_F4 : keyname = "VK_F4"; break; 172 case VK_F4 : keyname = "VK_F4"; break;
170 case VK_F5 : keyname = "VK_F5"; break; 173 case VK_F5 : keyname = "VK_F5"; break;
171 case VK_F6 : keyname = "VK_F6"; break; 174 case VK_F6 : keyname = "VK_F6"; break;
172 case VK_F7 : keyname = "VK_F7"; break; 175 case VK_F7 : keyname = "VK_F7"; break;
173 case VK_F8 : keyname = "VK_F8"; break; 176 case VK_F8 : keyname = "VK_F8"; break;
174 case VK_F9 : keyname = "VK_F9"; break; 177 case VK_F9 : keyname = "VK_F9"; break;
175 case VK_F10 : keyname = "VK_F10"; break; 178 case VK_F10 : keyname = "VK_F10"; break;
176 case VK_F11 : keyname = "VK_F11"; break; 179 case VK_F11 : keyname = "VK_F11"; break;
177 case VK_F12 : keyname = "VK_F12"; break; 180 case VK_F12 : keyname = "VK_F12"; break;
178 case VK_F13 : keyname = "VK_F13"; break; 181 case VK_F13 : keyname = "VK_F13"; break;
179 case VK_F14 : keyname = "VK_F14"; break; 182 case VK_F14 : keyname = "VK_F14"; break;
180 case VK_F15 : keyname = "VK_F15"; break; 183 case VK_F15 : keyname = "VK_F15"; break;
181 case VK_F16 : keyname = "VK_F16"; break; 184 case VK_F16 : keyname = "VK_F16"; break;
182 case VK_F17 : keyname = "VK_F17"; break; 185 case VK_F17 : keyname = "VK_F17"; break;
183 case VK_F18 : keyname = "VK_F18"; break; 186 case VK_F18 : keyname = "VK_F18"; break;
184 case VK_F19 : keyname = "VK_F19"; break; 187 case VK_F19 : keyname = "VK_F19"; break;
185 case VK_F20 : keyname = "VK_F20"; break; 188 case VK_F20 : keyname = "VK_F20"; break;
186 case VK_F21 : keyname = "VK_F21"; break; 189 case VK_F21 : keyname = "VK_F21"; break;
187 case VK_F22 : keyname = "VK_F22"; break; 190 case VK_F22 : keyname = "VK_F22"; break;
188 case VK_F23 : keyname = "VK_F23"; break; 191 case VK_F23 : keyname = "VK_F23"; break;
189 case VK_F24 : keyname = "VK_F24"; break; 192 case VK_F24 : keyname = "VK_F24"; break;
190 case VK_NUMLOCK : keyname = "VK_NUMLOCK"; break; 193 case VK_NUMLOCK : keyname = "VK_NUMLOCK"; break;
191 case VK_SCROLL : keyname = "VK_SCROLL"; break; 194 case VK_SCROLL : keyname = "VK_SCROLL"; break;
192 case VK_LSHIFT : keyname = "VK_LSHIFT"; break; 195 case VK_LSHIFT : keyname = "VK_LSHIFT"; break;
193 case VK_RSHIFT : keyname = "VK_RSHIFT"; break; 196 case VK_RSHIFT : keyname = "VK_RSHIFT"; break;
194 case VK_LCONTROL: keyname = "VK_LCONTROL"; break; 197 case VK_LCONTROL: keyname = "VK_LCONTROL"; break;
195 case VK_RCONTROL: keyname = "VK_RCONTROL"; break; 198 case VK_RCONTROL: keyname = "VK_RCONTROL"; break;
196 /* case VK_LMENU : keyname = "VK_LMENU"; break; */ 199 /* case VK_LMENU : keyname = "VK_LMENU"; break; */
197 /* case VK_RMENU : keyname = "VK_RMENU"; break;*/ 200 /* case VK_RMENU : keyname = "VK_RMENU"; break;*/
198 default: keyname = "<unknown>"; break; 201 default: keyname = "<unknown>"; break;
199 } 202 }
200 return keyname; 203 return keyname;
201 } 204 }
202 205
203 char *resolve_keymodifiers( int mask ) 206 char *resolve_keymodifiers( int mask )
204 { 207 {
205 if ( (mask & KC_CTRL) && (mask & KC_SHIFT) && (mask & KC_ALT) ) 208 if ( (mask & KC_CTRL) && (mask & KC_SHIFT) && (mask & KC_ALT) )
206 return "KC_CTRL KC_SHIFT KC_ALT"; 209 return "KC_CTRL KC_SHIFT KC_ALT";
207 else if ( (mask & KC_CTRL) && (mask & KC_SHIFT) ) 210 else if ( (mask & KC_CTRL) && (mask & KC_SHIFT) )
208 return "KC_CTRL KC_SHIFT"; 211 return "KC_CTRL KC_SHIFT";
209 else if ( (mask & KC_CTRL) && (mask & KC_ALT) ) 212 else if ( (mask & KC_CTRL) && (mask & KC_ALT) )
210 return "KC_CTRL KC_ALT"; 213 return "KC_CTRL KC_ALT";
211 else if ( (mask & KC_SHIFT) && (mask & KC_ALT) ) 214 else if ( (mask & KC_SHIFT) && (mask & KC_ALT) )
212 return "KC_SHIFT KC_ALT"; 215 return "KC_SHIFT KC_ALT";
213 else if ( (mask & KC_SHIFT) ) 216 else if ( (mask & KC_SHIFT) )
214 return "KC_SHIFT"; 217 return "KC_SHIFT";
215 else if ( (mask & KC_CTRL) ) 218 else if ( (mask & KC_CTRL) )
216 return "KC_CTRL"; 219 return "KC_CTRL";
217 else if ( (mask & KC_ALT) ) 220 else if ( (mask & KC_ALT) )
218 return "KC_ALT"; 221 return "KC_ALT";
219 else return "none"; 222 else return "none";
220 } 223 }
224
225 void update_render(void);
221 226
222 /* This gets called when a part of the graph needs to be repainted. */ 227 /* This gets called when a part of the graph needs to be repainted. */
223 int DWSIGNAL text_expose(HWND hwnd, DWExpose *exp, void *data) 228 int DWSIGNAL text_expose(HWND hwnd, DWExpose *exp, void *data)
224 { 229 {
225 HPIXMAP hpm; 230 if(render_type != 1)
226 unsigned long width,height; 231 {
227 232 HPIXMAP hpm;
228 if ( hwnd == textbox1 ) 233 unsigned long width,height;
229 hpm = text1pm; 234
230 else if ( hwnd == textbox2 ) 235 if ( hwnd == textbox1 )
231 hpm = text2pm; 236 hpm = text1pm;
232 else 237 else if ( hwnd == textbox2 )
233 return TRUE; 238 hpm = text2pm;
234 239 else
235 width = (int)DW_PIXMAP_WIDTH(hpm); 240 return TRUE;
236 height = (int)DW_PIXMAP_HEIGHT(hpm); 241
237 242 width = (int)DW_PIXMAP_WIDTH(hpm);
238 dw_pixmap_bitblt(hwnd, NULL, 0, 0, (int)width, (int)height, 0, hpm, 0, 0 ); 243 height = (int)DW_PIXMAP_HEIGHT(hpm);
239 dw_flush(); 244
240 return TRUE; 245 dw_pixmap_bitblt(hwnd, NULL, 0, 0, (int)width, (int)height, 0, hpm, 0, 0 );
246 dw_flush();
247 }
248 else
249 {
250 update_render();
251 }
252 return TRUE;
241 } 253 }
242 254
243 void read_file( void ) 255 void read_file( void )
244 { 256 {
245 int i,len; 257 int i,len;
246 fp = fopen( current_file, "r" ); 258 fp = fopen( current_file, "r" );
247 lp = (char **)calloc( 1000,sizeof(char *)); 259 lp = (char **)calloc( 1000,sizeof(char *));
248 /* should test for out of memory */ 260 /* should test for out of memory */
249 max_linewidth=0; 261 max_linewidth=0;
250 for ( i = 0; i < 1000; i++ ) 262 for ( i = 0; i < 1000; i++ )
251 { 263 {
252 lp[i] = (char *)calloc(1, 1025); 264 lp[i] = (char *)calloc(1, 1025);
253 if ( fgets( lp[i], 1024, fp ) == NULL ) 265 if ( fgets( lp[i], 1024, fp ) == NULL )
254 break; 266 break;
255 len = strlen( lp[i] ); 267 len = (int)strlen( lp[i] );
256 if ( len > max_linewidth ) 268 if ( len > max_linewidth )
257 max_linewidth = len; 269 max_linewidth = len;
258 if ( lp[i][len - 1] == '\n' ) 270 if ( lp[i][len - 1] == '\n' )
259 lp[i][len - 1] = '\0'; 271 lp[i][len - 1] = '\0';
260 } 272 }
261 num_lines = i; 273 num_lines = i;
262 fclose( fp ); 274 fclose( fp );
263 dw_scrollbar_set_range(hscrollbar, max_linewidth, cols); 275 dw_scrollbar_set_range(hscrollbar, max_linewidth, cols);
264 dw_scrollbar_set_pos(hscrollbar, 0); 276 dw_scrollbar_set_pos(hscrollbar, 0);
265 dw_scrollbar_set_range(vscrollbar, num_lines, rows); 277 dw_scrollbar_set_range(vscrollbar, num_lines, rows);
266 dw_scrollbar_set_pos(vscrollbar, 0); 278 dw_scrollbar_set_pos(vscrollbar, 0);
267 } 279 }
268 280
269 void draw_file( int row, int col ) 281 void draw_file( int row, int col )
270 { 282 {
271 char buf[10]; 283 char buf[10];
272 int i,y,fileline; 284 int i,y,fileline;
273 char *pLine; 285 char *pLine;
274 286
275 if ( current_file ) 287 if ( current_file )
276 { 288 {
277 dw_color_foreground_set(DW_CLR_WHITE); 289 dw_color_foreground_set(DW_CLR_WHITE);
278 dw_draw_rect(0, text1pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text1pm), (int)DW_PIXMAP_HEIGHT(text1pm)); 290 dw_draw_rect(0, text1pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text1pm), (int)DW_PIXMAP_HEIGHT(text1pm));
279 dw_draw_rect(0, text2pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text2pm), (int)DW_PIXMAP_HEIGHT(text2pm)); 291 dw_draw_rect(0, text2pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text2pm), (int)DW_PIXMAP_HEIGHT(text2pm));
280 292
281 for ( i = 0;(i < rows) && (i+row < num_lines); i++) 293 for ( i = 0;(i < rows) && (i+row < num_lines); i++)
282 { 294 {
283 fileline = i + row - 1; 295 fileline = i + row - 1;
284 y = i*font_height; 296 y = i*font_height;
285 dw_color_background_set( 1 + (fileline % 15) ); 297 dw_color_background_set( 1 + (fileline % 15) );
286 dw_color_foreground_set( fileline < 0 ? DW_CLR_WHITE : fileline % 16 ); 298 dw_color_foreground_set( fileline < 0 ? DW_CLR_WHITE : fileline % 16 );
287 sprintf( buf, "%6.6d", i+row ); 299 sprintf( buf, "%6.6d", i+row );
288 dw_draw_text( 0, text1pm, 0, y, buf); 300 dw_draw_text( 0, text1pm, 0, y, buf);
289 pLine = lp[i+row]; 301 pLine = lp[i+row];
290 dw_draw_text( 0, text2pm, 0, y, pLine+col ); 302 dw_draw_text( 0, text2pm, 0, y, pLine+col );
291 } 303 }
292 text_expose( textbox1, NULL, NULL); 304 text_expose( textbox1, NULL, NULL);
293 text_expose( textbox2, NULL, NULL); 305 text_expose( textbox2, NULL, NULL);
294 } 306 }
295 } 307 }
296 308
309 void draw_shapes(int direct)
310 {
311 int width = (int)DW_PIXMAP_WIDTH(text2pm), height = (int)DW_PIXMAP_HEIGHT(text2pm);
312 HPIXMAP pixmap = direct ? NULL : text2pm;
313 HWND window = direct ? textbox2 : 0;
314
315 dw_color_foreground_set(DW_CLR_WHITE);
316 dw_draw_rect(window, pixmap, TRUE, 0, 0, width, height);
317 dw_color_foreground_set(DW_CLR_DARKPINK);
318 dw_draw_rect(window, pixmap, TRUE, 10, 10, width - 20, height - 20);
319 dw_color_foreground_set(DW_CLR_GREEN);
320 dw_color_background_set(DW_CLR_DARKRED);
321 dw_draw_text(window, pixmap, 10, 10, "This should be aligned with the edges.");
322
323 /* If we aren't drawing direct do a bitblt */
324 if(!direct)
325 {
326 text_expose( textbox2, NULL, NULL);
327 }
328 }
329
330 void update_render(void)
331 {
332 switch(render_type)
333 {
334 case 0:
335 draw_shapes(FALSE);
336 break;
337 case 1:
338 draw_shapes(TRUE);
339 break;
340 case 2:
341 draw_file(current_row, current_col);
342 break;
343 }
344 }
345
346 int DWSIGNAL refresh_callback(HWND window, void *data)
347 {
348 update_render();
349 return FALSE;
350 }
351
352 int DWSIGNAL render_select_event_callback(HWND window, int index)
353 {
354 if(index != render_type)
355 {
356 if(index == 2)
357 {
358 dw_scrollbar_set_range(hscrollbar, max_linewidth, cols);
359 dw_scrollbar_set_pos(hscrollbar, 0);
360 dw_scrollbar_set_range(vscrollbar, num_lines, rows);
361 dw_scrollbar_set_pos(vscrollbar, 0);
362 current_col = current_row = 0;
363 }
364 else
365 {
366 dw_scrollbar_set_range(hscrollbar, 0, 0);
367 dw_scrollbar_set_pos(hscrollbar, 0);
368 dw_scrollbar_set_range(vscrollbar, 0, 0);
369 dw_scrollbar_set_pos(vscrollbar, 0);
370 }
371 render_type = index;
372 update_render();
373 }
374 return FALSE;
375 }
297 376
298 int DWSIGNAL colorchoose_callback(HWND window, void *data) 377 int DWSIGNAL colorchoose_callback(HWND window, void *data)
299 { 378 {
300 current_color = dw_color_choose(current_color); 379 current_color = dw_color_choose(current_color);
301 return FALSE; 380 return FALSE;
302 } 381 }
303 382
304 int DWSIGNAL cursortoggle_callback(HWND window, void *data) 383 int DWSIGNAL cursortoggle_callback(HWND window, void *data)
305 { 384 {
306 if(cursor_arrow) 385 if(cursor_arrow)
307 { 386 {
308 dw_window_set_text((HWND)cursortogglebutton,"Set Cursor pointer - ARROW"); 387 dw_window_set_text((HWND)cursortogglebutton,"Set Cursor pointer - ARROW");
309 dw_window_set_pointer((HWND)data,DW_POINTER_CLOCK); 388 dw_window_set_pointer((HWND)data,DW_POINTER_CLOCK);
310 cursor_arrow = 0; 389 cursor_arrow = 0;
311 } 390 }
312 else 391 else
313 { 392 {
314 dw_window_set_text((HWND)cursortogglebutton,"Set Cursor pointer - CLOCK"); 393 dw_window_set_text((HWND)cursortogglebutton,"Set Cursor pointer - CLOCK");
315 dw_window_set_pointer((HWND)data,DW_POINTER_DEFAULT); 394 dw_window_set_pointer((HWND)data,DW_POINTER_DEFAULT);
316 cursor_arrow = 1; 395 cursor_arrow = 1;
317 } 396 }
318 return FALSE; 397 return FALSE;
319 } 398 }
320 399
321 int DWSIGNAL beep_callback(HWND window, void *data) 400 int DWSIGNAL beep_callback(HWND window, void *data)
322 { 401 {
323 dw_timer_disconnect( timerid ); 402 dw_timer_disconnect( timerid );
324 return TRUE; 403 return TRUE;
325 } 404 }
326 405
327 int DWSIGNAL keypress_callback(HWND window, char ch, int vk, int state, void *data) 406 int DWSIGNAL keypress_callback(HWND window, char ch, int vk, int state, void *data)
328 { 407 {
329 char tmpbuf[100]; 408 char tmpbuf[100];
330 if ( ch ) 409 if ( ch )
331 sprintf( tmpbuf, "Key: %c(%d) Modifiers: %s(%d)", ch, ch, resolve_keymodifiers(state), state ); 410 sprintf( tmpbuf, "Key: %c(%d) Modifiers: %s(%d)", ch, ch, resolve_keymodifiers(state), state );
332 else 411 else
333 sprintf( tmpbuf, "Key: %s(%d) Modifiers: %s(%d)", resolve_keyname(vk), vk, resolve_keymodifiers(state), state ); 412 sprintf( tmpbuf, "Key: %s(%d) Modifiers: %s(%d)", resolve_keyname(vk), vk, resolve_keymodifiers(state), state );
334 dw_window_set_text( status, tmpbuf); 413 dw_window_set_text( status1, tmpbuf);
335 return 0; 414 return 0;
336 } 415 }
337 416
338 int DWSIGNAL menu_callback(HWND window, void *data) 417 int DWSIGNAL menu_callback(HWND window, void *data)
339 { 418 {
340 char buf[100]; 419 char buf[100];
341 420
342 sprintf( buf, "%s menu item selected", (char *)data ); 421 sprintf( buf, "%s menu item selected", (char *)data );
343 dw_messagebox( "Menu Item Callback", DW_MB_OK | DW_MB_INFORMATION, buf ); 422 dw_messagebox( "Menu Item Callback", DW_MB_OK | DW_MB_INFORMATION, buf );
344 return 0; 423 return 0;
345 } 424 }
346 425
347 int DWSIGNAL menutoggle_callback(HWND window, void *data) 426 int DWSIGNAL menutoggle_callback(HWND window, void *data)
348 { 427 {
349 if ( menu_enabled ) 428 if ( menu_enabled )
350 { 429 {
351 dw_menu_item_set_state( changeable_menu, CHECKABLE_MENUITEMID, DW_MIS_DISABLED ); 430 dw_menu_item_set_state( changeable_menu, CHECKABLE_MENUITEMID, DW_MIS_DISABLED );
352 dw_menu_item_set_state( changeable_menu, NONCHECKABLE_MENUITEMID, DW_MIS_DISABLED ); 431 dw_menu_item_set_state( changeable_menu, NONCHECKABLE_MENUITEMID, DW_MIS_DISABLED );
353 menu_enabled = 0; 432 menu_enabled = 0;
354 } 433 }
355 else 434 else
356 { 435 {
357 dw_menu_item_set_state( changeable_menu, CHECKABLE_MENUITEMID, DW_MIS_ENABLED ); 436 dw_menu_item_set_state( changeable_menu, CHECKABLE_MENUITEMID, DW_MIS_ENABLED );
358 dw_menu_item_set_state( changeable_menu, NONCHECKABLE_MENUITEMID, DW_MIS_ENABLED ); 437 dw_menu_item_set_state( changeable_menu, NONCHECKABLE_MENUITEMID, DW_MIS_ENABLED );
359 menu_enabled = 1; 438 menu_enabled = 1;
360 } 439 }
361 return 0; 440 return 0;
362 } 441 }
363 442
364 int DWSIGNAL helpabout_callback(HWND window, void *data) 443 int DWSIGNAL helpabout_callback(HWND window, void *data)
365 { 444 {
366 char buf[100]; 445 char buf[100];
367 DWEnv env; 446 DWEnv env;
368 447
369 dw_environment_query(&env); 448 dw_environment_query(&env);
370 sprintf( buf, "dwindows test\n\nOS: %s %s %s Version: %d.%d.%d.%d\n\ndwindows Version: %d.%d.%d", 449 sprintf( buf, "dwindows test\n\nOS: %s %s %s Version: %d.%d.%d.%d\n\ndwindows Version: %d.%d.%d",
371 env.osName, env.buildDate, env.buildTime, 450 env.osName, env.buildDate, env.buildTime,
372 env.MajorVersion, env.MinorVersion, env.MajorBuild, env.MinorBuild, 451 env.MajorVersion, env.MinorVersion, env.MajorBuild, env.MinorBuild,
373 env.DWMajorVersion, env.DWMinorVersion, env.DWSubVersion ); 452 env.DWMajorVersion, env.DWMinorVersion, env.DWSubVersion );
374 dw_messagebox( "About dwindows", DW_MB_OK | DW_MB_INFORMATION, buf ); 453 dw_messagebox( "About dwindows", DW_MB_OK | DW_MB_INFORMATION, buf );
375 return 0; 454 return 0;
376 } 455 }
377 456
378 int DWSIGNAL exit_callback(HWND window, void *data) 457 int DWSIGNAL exit_callback(HWND window, void *data)
379 { 458 {
380 dw_window_destroy((HWND)data); 459 dw_window_destroy((HWND)data);
381 exit(0); 460 exit(0);
382 return -1; 461 return -1;
383 } 462 }
384 463
385 int DWSIGNAL test_callback(HWND window, void *data) 464 int DWSIGNAL test_callback(HWND window, void *data)
386 { 465 {
387 dw_window_destroy((HWND)data); 466 dw_window_destroy((HWND)data);
388 if ( current_file ) 467 if ( current_file )
389 dw_free( current_file ); 468 dw_free( current_file );
390 exit(0); 469 exit(0);
391 return -1; 470 return -1;
392 } 471 }
393 472
394 int DWSIGNAL browse_file_callback(HWND window, void *data) 473 int DWSIGNAL browse_file_callback(HWND window, void *data)
395 { 474 {
396 char *tmp; 475 char *tmp;
397 tmp = dw_file_browse("Pick a file", ".", "c", DW_FILE_OPEN ); 476 tmp = dw_file_browse("Pick a file", ".", "c", DW_FILE_OPEN );
398 if ( tmp ) 477 if ( tmp )
399 { 478 {
400 if ( current_file ) 479 if ( current_file )
401 { 480 {
402 dw_free( current_file ); 481 dw_free( current_file );
403 } 482 }
404 current_file = tmp; 483 current_file = tmp;
405 dw_window_set_text( entryfield, current_file ); 484 dw_window_set_text( entryfield, current_file );
406 read_file(); 485 read_file();
407 draw_file(0,0); 486 current_col = current_row = 0;
408 } 487 update_render();
409 return 0; 488 }
489 return 0;
410 } 490 }
411 491
412 int DWSIGNAL browse_folder_callback(HWND window, void *data) 492 int DWSIGNAL browse_folder_callback(HWND window, void *data)
413 { 493 {
414 char *tmp = dw_file_browse("Pick a folder", ".", "c", DW_DIRECTORY_OPEN ); 494 char *tmp = dw_file_browse("Pick a folder", ".", "c", DW_DIRECTORY_OPEN );
415 printf("Folder picked: %s\n", tmp ? tmp : "None"); 495 printf("Folder picked: %s\n", tmp ? tmp : "None");
416 return 0; 496 return 0;
417 } 497 }
418 498
419 int DWSIGNAL button_callback(HWND window, void *data) 499 int DWSIGNAL button_callback(HWND window, void *data)
420 { 500 {
421 unsigned int y,m,d; 501 unsigned int y,m,d;
422 unsigned int idx; 502 unsigned int idx;
423 int len; 503 int len;
424 long spvalue; 504 long spvalue;
425 char buf1[100]; 505 char buf1[100];
426 char buf2[100]; 506 char buf2[100];
427 char buf3[500]; 507 char buf3[500];
428 508
429 idx = dw_listbox_selected( combobox1 ); 509 idx = dw_listbox_selected( combobox1 );
430 dw_listbox_get_text( combobox1, idx, buf1, 99 ); 510 dw_listbox_get_text( combobox1, idx, buf1, 99 );
431 idx = dw_listbox_selected( combobox2 ); 511 idx = dw_listbox_selected( combobox2 );
432 dw_listbox_get_text( combobox2, idx, buf2, 99 ); 512 dw_listbox_get_text( combobox2, idx, buf2, 99 );
433 dw_calendar_get_date( cal, &y, &m, &d ); 513 dw_calendar_get_date( cal, &y, &m, &d );
434 spvalue = dw_spinbutton_get_pos( spinbutton ); 514 spvalue = dw_spinbutton_get_pos( spinbutton );
435 len = sprintf( buf3, "spinbutton: %ld\ncombobox1: \"%s\"\ncombobox2: \"%s\"\ncalendar: %d-%d-%d", 515 len = sprintf( buf3, "spinbutton: %ld\ncombobox1: \"%s\"\ncombobox2: \"%s\"\ncalendar: %d-%d-%d",
436 spvalue, 516 spvalue,
437 buf1, buf2, 517 buf1, buf2,
438 y, m, d ); 518 y, m, d );
439 dw_messagebox( "Values", DW_MB_OK | DW_MB_INFORMATION, buf3 ); 519 dw_messagebox( "Values", DW_MB_OK | DW_MB_INFORMATION, buf3 );
440 dw_clipboard_set_text( buf3, len ); 520 dw_clipboard_set_text( buf3, len );
441 return 0; 521 return 0;
442 } 522 }
443 523
444 int DWSIGNAL redraw_button_box_callback(HWND window, void *data) 524 int DWSIGNAL redraw_button_box_callback(HWND window, void *data)
445 { 525 {
446 #if 0 526 #if 0
447 527
448 long x, y, width, height; 528 long x, y, width, height;
449 dw_window_get_pos_size(filetoolbarbox , &x, &y, &width, &height); 529 dw_window_get_pos_size(filetoolbarbox , &x, &y, &width, &height);
450 dw_window_destroy( filetoolbarbox ); 530 dw_window_destroy( filetoolbarbox );
451 create_button(1); 531 create_button(1);
452 dw_window_set_pos_size(filetoolbarbox, x, y, width, height); 532 dw_window_set_pos_size(filetoolbarbox, x, y, width, height);
453 #else 533 #else
454 dw_window_enable( window); 534 dw_window_enable( window);
455 dw_window_destroy( noncheckable_menuitem ); 535 dw_window_destroy( noncheckable_menuitem );
456 #endif 536 #endif
457 return 0; 537 return 0;
458 } 538 }
459 539
460 int DWSIGNAL change_color_red_callback(HWND window, void *data) 540 int DWSIGNAL change_color_red_callback(HWND window, void *data)
461 { 541 {
462 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED); 542 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED);
463 return 0; 543 return 0;
464 } 544 }
465 545
466 int DWSIGNAL change_color_yellow_callback(HWND window, void *data) 546 int DWSIGNAL change_color_yellow_callback(HWND window, void *data)
467 { 547 {
468 dw_window_set_color(buttonsbox, DW_CLR_YELLOW, DW_CLR_YELLOW); 548 dw_window_set_color(buttonsbox, DW_CLR_YELLOW, DW_CLR_YELLOW);
469 return 0; 549 return 0;
470 } 550 }
471 551
472 552
473 /* Callback to handle user selection of the scrollbar position */ 553 /* Callback to handle user selection of the scrollbar position */
474 void DWSIGNAL scrollbar_valuechanged_callback(HWND hwnd, int value, void *data) 554 void DWSIGNAL scrollbar_valuechanged_callback(HWND hwnd, int value, void *data)
475 { 555 {
476 if(data) 556 if(data)
477 { 557 {
478 HWND stext = (HWND)data; 558 HWND stext = (HWND)data;
479 char tmpbuf[100]; 559 char tmpbuf[100];
480 if ( hwnd == vscrollbar ) 560 if ( hwnd == vscrollbar )
481 { 561 {
482 current_row = value; 562 current_row = value;
483 } 563 }
484 else 564 else
485 { 565 {
486 current_col = value; 566 current_col = value;
487 } 567 }
488 sprintf(tmpbuf, "Row:%d Col:%d Lines:%d Cols:%d", current_row,current_col,num_lines,max_linewidth); 568 sprintf(tmpbuf, "Row:%d Col:%d Lines:%d Cols:%d", current_row,current_col,num_lines,max_linewidth);
489 dw_window_set_text(stext, tmpbuf); 569 dw_window_set_text(stext, tmpbuf);
490 draw_file( current_row, current_col); 570 update_render();
491 } 571 }
492 } 572 }
493 573
494 /* Callback to handle user selection of the spinbutton position */ 574 /* Callback to handle user selection of the spinbutton position */
495 void DWSIGNAL spinbutton_valuechanged_callback(HWND hwnd, int value, void *data) 575 void DWSIGNAL spinbutton_valuechanged_callback(HWND hwnd, int value, void *data)
496 { 576 {
497 dw_messagebox("DWTest", DW_MB_OK, "New value from spinbutton: %d\n", value); 577 dw_messagebox("DWTest", DW_MB_OK, "New value from spinbutton: %d\n", value);
498 } 578 }
499 579
500 /* Callback to handle user selection of the slider position */ 580 /* Callback to handle user selection of the slider position */
501 void DWSIGNAL slider_valuechanged_callback(HWND hwnd, int value, void *data) 581 void DWSIGNAL slider_valuechanged_callback(HWND hwnd, int value, void *data)
502 { 582 {
503 dw_messagebox("DWTest", DW_MB_OK, "New value from slider: %d\n", value); 583 dw_messagebox("DWTest", DW_MB_OK, "New value from slider: %d\n", value);
504 } 584 }
505 585
506 /* Handle size change of the main render window */ 586 /* Handle size change of the main render window */
507 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data) 587 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data)
508 { 588 {
509 HPIXMAP old1 = text1pm, old2 = text2pm; 589 HPIXMAP old1 = text1pm, old2 = text2pm;
510 unsigned long depth = dw_color_depth_get(); 590 unsigned long depth = dw_color_depth_get();
511 591
512 rows = height / font_height; 592 rows = height / font_height;
513 cols = width / font_width; 593 cols = width / font_width;
514 594
515 /* Create new pixmaps with the current sizes */ 595 /* Create new pixmaps with the current sizes */
516 text1pm = dw_pixmap_new(textbox1, (unsigned long)(font_width*(width1)), (unsigned long)height, (int)depth); 596 text1pm = dw_pixmap_new(textbox1, (unsigned long)(font_width*(width1)), (unsigned long)height, (int)depth);
517 text2pm = dw_pixmap_new(textbox2, (unsigned long)width, (unsigned long)height, (int)depth); 597 text2pm = dw_pixmap_new(textbox2, (unsigned long)width, (unsigned long)height, (int)depth);
518 598
519 /* Destroy the old pixmaps */ 599 /* Destroy the old pixmaps */
520 dw_pixmap_destroy(old1); 600 dw_pixmap_destroy(old1);
521 dw_pixmap_destroy(old2); 601 dw_pixmap_destroy(old2);
522 602
523 /* Update scrollbar ranges with new values */ 603 /* Update scrollbar ranges with new values */
524 dw_scrollbar_set_range(hscrollbar, max_linewidth, cols); 604 dw_scrollbar_set_range(hscrollbar, max_linewidth, cols);
525 dw_scrollbar_set_range(vscrollbar, num_lines, rows); 605 dw_scrollbar_set_range(vscrollbar, num_lines, rows);
526 606
527 /* Redraw the window */ 607 /* Redraw the window */
528 draw_file( current_row, current_col); 608 update_render();
529 return TRUE; 609 return TRUE;
530 } 610 }
531 611
532 int DWSIGNAL item_enter_cb( HWND window, char *text, void *data ) 612 int DWSIGNAL item_enter_cb( HWND window, char *text, void *data )
533 { 613 {
534 char buf[200]; 614 char buf[200];
535 HWND statline = (HWND)data; 615 HWND statline = (HWND)data;
536 616
537 sprintf(buf,"DW_SIGNAL_ITEM_ENTER: Window: %x Text: %s", (unsigned int)window, text ); 617 sprintf(buf,"DW_SIGNAL_ITEM_ENTER: Window: %x Text: %s", (unsigned int)window, text );
538 dw_window_set_text( statline, buf); 618 dw_window_set_text( statline, buf);
539 return 0; 619 return 0;
540 } 620 }
541 621
542 int DWSIGNAL item_context_cb( HWND window, char *text, int x, int y, void *data, void *itemdata ) 622 int DWSIGNAL item_context_cb( HWND window, char *text, int x, int y, void *data, void *itemdata )
543 { 623 {
544 char buf[200]; 624 char buf[200];
545 HWND statline = (HWND)data; 625 HWND statline = (HWND)data;
546 626
547 sprintf(buf,"DW_SIGNAL_ITEM_CONTEXT: Window: %x Text: %s x: %d y: %d Itemdata: %x", (unsigned int)window, text, x, y, (unsigned int)itemdata ); 627 sprintf(buf,"DW_SIGNAL_ITEM_CONTEXT: Window: %x Text: %s x: %d y: %d Itemdata: %x", (unsigned int)window, text, x, y, (unsigned int)itemdata );
548 dw_window_set_text( statline, buf); 628 dw_window_set_text( statline, buf);
549 return 0; 629 return 0;
550 } 630 }
551 631
552 int DWSIGNAL list_select_cb( HWND window, int item, void *data ) 632 int DWSIGNAL list_select_cb( HWND window, int item, void *data )
553 { 633 {
554 char buf[200]; 634 char buf[200];
555 HWND statline = (HWND)data; 635 HWND statline = (HWND)data;
556 636
557 sprintf(buf,"DW_SIGNAL_LIST_SELECT: Window: %d Item: %d", (unsigned int)window, item ); 637 sprintf(buf,"DW_SIGNAL_LIST_SELECT: Window: %d Item: %d", (unsigned int)window, item );
558 dw_window_set_text( statline, buf); 638 dw_window_set_text( statline, buf);
559 return 0; 639 return 0;
560 } 640 }
561 641
562 int DWSIGNAL item_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata ) 642 int DWSIGNAL item_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata )
563 { 643 {
564 char buf[200]; 644 char buf[200];
565 HWND statline = (HWND)data; 645 HWND statline = (HWND)data;
566 646
567 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); 647 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata );
568 dw_window_set_text( statline, buf); 648 dw_window_set_text( statline, buf);
569 return 0; 649 return 0;
570 } 650 }
571 651
572 int DWSIGNAL container_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata ) 652 int DWSIGNAL container_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata )
573 { 653 {
574 char buf[200]; 654 char buf[200];
575 char *str; 655 char *str;
576 HWND statline = (HWND)data; 656 HWND statline = (HWND)data;
577 unsigned long size; 657 unsigned long size;
578 658
579 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); 659 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata );
580 dw_window_set_text( statline, buf); 660 dw_window_set_text( statline, buf);
581 sprintf(buf,"\r\nDW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x\r\n", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); 661 sprintf(buf,"\r\nDW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x\r\n", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata );
582 mle_point = dw_mle_import( container_mle, buf, mle_point); 662 mle_point = dw_mle_import( container_mle, buf, mle_point);
583 str = dw_container_query_start(container, DW_CRA_SELECTED); 663 str = dw_container_query_start(container, DW_CRA_SELECTED);
584 while(str) 664 while(str)
585 { 665 {
586 sprintf(buf,"Selected: %s\r\n", str); 666 sprintf(buf,"Selected: %s\r\n", str);
587 mle_point = dw_mle_import( container_mle, buf, mle_point); 667 mle_point = dw_mle_import( container_mle, buf, mle_point);
588 str = dw_container_query_next(container, DW_CRA_SELECTED); 668 str = dw_container_query_next(container, DW_CRA_SELECTED);
589 } 669 }
590 /* Make the last inserted point the cursor location */ 670 /* Make the last inserted point the cursor location */
591 dw_mle_set_cursor(container_mle, mle_point); 671 dw_mle_set_cursor(container_mle, mle_point);
592 /* set the details of item 0 to new data */ 672 /* set the details of item 0 to new data */
593 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon); 673 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon);
594 dw_filesystem_change_file(container, 0, "new data", fileicon); 674 dw_filesystem_change_file(container, 0, "new data", fileicon);
595 size = 999; 675 size = 999;
596 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon); 676 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon);
597 dw_filesystem_change_item(container, 1, 0, &size); 677 dw_filesystem_change_item(container, 1, 0, &size);
598 return 0; 678 return 0;
599 } 679 }
600 680
601 int DWSIGNAL switch_page_cb( HWND window, unsigned long page_num, void *itemdata ) 681 int DWSIGNAL switch_page_cb( HWND window, unsigned long page_num, void *itemdata )
602 { 682 {
603 FILE *fp=fopen("log","a"); 683 FILE *fp=fopen("log","a");
604 fprintf(fp,"DW_SIGNAL_SWITCH_PAGE: Window: %x PageNum: %u Itemdata: %x\n", (unsigned int)window, (unsigned int)page_num, (unsigned int)itemdata ); 684 fprintf(fp,"DW_SIGNAL_SWITCH_PAGE: Window: %x PageNum: %u Itemdata: %x\n", (unsigned int)window, (unsigned int)page_num, (unsigned int)itemdata );
605 fclose(fp); 685 fclose(fp);
606 return 0; 686 return 0;
607 } 687 }
608 688
609 int DWSIGNAL column_click_cb( HWND window, int column_num, void *data ) 689 int DWSIGNAL column_click_cb( HWND window, int column_num, void *data )
610 { 690 {
611 char buf[200], buf1[100]; 691 char buf[200], buf1[100];
612 HWND statline = (HWND)data; 692 HWND statline = (HWND)data;
613 int column_type; 693 int column_type;
614 694
615 if(column_num == 0) 695 if(column_num == 0)
616 strcpy(buf1,"Filename"); 696 strcpy(buf1,"Filename");
617 else 697 else
618 { 698 {
619 column_type = dw_filesystem_get_column_type( window, column_num-1 ); 699 column_type = dw_filesystem_get_column_type( window, column_num-1 );
620 if( column_type == DW_CFA_STRING) 700 if( column_type == DW_CFA_STRING)
621 strcpy(buf1,"String"); 701 strcpy(buf1,"String");
622 else if( column_type == DW_CFA_ULONG) 702 else if( column_type == DW_CFA_ULONG)
623 strcpy(buf1,"ULong"); 703 strcpy(buf1,"ULong");
624 else if( column_type == DW_CFA_DATE) 704 else if( column_type == DW_CFA_DATE)
625 strcpy(buf1,"Date"); 705 strcpy(buf1,"Date");
626 else if( column_type == DW_CFA_TIME) 706 else if( column_type == DW_CFA_TIME)
627 strcpy(buf1,"Time"); 707 strcpy(buf1,"Time");
628 else if( column_type == DW_CFA_BITMAPORICON) 708 else if( column_type == DW_CFA_BITMAPORICON)
629 strcpy(buf1,"BitmapOrIcon"); 709 strcpy(buf1,"BitmapOrIcon");
630 else 710 else
631 strcpy(buf1,"Unknown"); 711 strcpy(buf1,"Unknown");
632 } 712 }
633 sprintf(buf,"DW_SIGNAL_COLUMN_CLICK: Window: %x Column: %d Type: %s Itemdata: %x", (unsigned int)window, column_num, buf1, (unsigned int)data ); 713 sprintf(buf,"DW_SIGNAL_COLUMN_CLICK: Window: %x Column: %d Type: %s Itemdata: %x", (unsigned int)window, column_num, buf1, (unsigned int)data );
634 dw_window_set_text( statline, buf); 714 dw_window_set_text( statline, buf);
635 return 0; 715 return 0;
636 } 716 }
637 717
638 int DWSIGNAL combobox_select_event_callback(HWND window, int index) 718 int DWSIGNAL combobox_select_event_callback(HWND window, int index)
639 { 719 {
640 fprintf(stderr,"got combobox_select_event for index: %d, iteration: %d\n", index, iteration++); 720 fprintf(stderr,"got combobox_select_event for index: %d, iteration: %d\n", index, iteration++);
641 return FALSE; 721 return FALSE;
642 } 722 }
643 723
644 void archive_add(void) 724 void archive_add(void)
645 { 725 {
646 HWND browsefilebutton, browsefolderbutton, browsebox; 726 HWND browsefilebutton, browsefolderbutton, browsebox;
647 727
648 lbbox = dw_box_new(BOXVERT, 10); 728 lbbox = dw_box_new(BOXVERT, 10);
649 729
650 dw_box_pack_start(notebookbox1, lbbox, 150, 70, TRUE, TRUE, 0); 730 dw_box_pack_start(notebookbox1, lbbox, 150, 70, TRUE, TRUE, 0);
651 731
652 /* Archive Name */ 732 /* Archive Name */
653 stext = dw_text_new("File to browse", 0); 733 stext = dw_text_new("File to browse", 0);
654 734
655 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER); 735 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER);
656 736
657 dw_box_pack_start(lbbox, stext, 130, 15, TRUE, TRUE, 2); 737 dw_box_pack_start(lbbox, stext, 130, 15, TRUE, TRUE, 2);
658 738
659 browsebox = dw_box_new(BOXHORZ, 0); 739 browsebox = dw_box_new(BOXHORZ, 0);
660 740
661 dw_box_pack_start(lbbox, browsebox, 0, 0, TRUE, TRUE, 0); 741 dw_box_pack_start(lbbox, browsebox, 0, 0, TRUE, TRUE, 0);
662 742
663 entryfield = dw_entryfield_new("", 100L); 743 entryfield = dw_entryfield_new("", 100L);
664 744
665 dw_entryfield_set_limit(entryfield, 260); 745 dw_entryfield_set_limit(entryfield, 260);
666 746
667 dw_box_pack_start(browsebox, entryfield, 100, 15, TRUE, TRUE, 4); 747 dw_box_pack_start(browsebox, entryfield, 100, 15, TRUE, TRUE, 4);
668 748
669 browsefilebutton = dw_button_new("Browse File", 1001L); 749 browsefilebutton = dw_button_new("Browse File", 1001L);
670 750
671 dw_box_pack_start(browsebox, browsefilebutton, 40, 15, TRUE, TRUE, 0); 751 dw_box_pack_start(browsebox, browsefilebutton, 40, 15, TRUE, TRUE, 0);
672 752
673 browsefolderbutton = dw_button_new("Browse Folder", 1001L); 753 browsefolderbutton = dw_button_new("Browse Folder", 1001L);
674 754
675 dw_box_pack_start(browsebox, browsefolderbutton, 40, 15, TRUE, TRUE, 0); 755 dw_box_pack_start(browsebox, browsefolderbutton, 40, 15, TRUE, TRUE, 0);
676 756
677 dw_window_set_color(browsebox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); 757 dw_window_set_color(browsebox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
678 dw_window_set_color(stext, DW_CLR_BLACK, DW_CLR_PALEGRAY); 758 dw_window_set_color(stext, DW_CLR_BLACK, DW_CLR_PALEGRAY);
679 759
680 /* Buttons */ 760 /* Buttons */
681 buttonbox = dw_box_new(BOXHORZ, 10); 761 buttonbox = dw_box_new(BOXHORZ, 10);
682 762
683 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); 763 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0);
684 764
685 cursortogglebutton = dw_button_new("Set Cursor pointer - CLOCK", 1003L); 765 cursortogglebutton = dw_button_new("Set Cursor pointer - CLOCK", 1003L);
686 dw_box_pack_start(buttonbox, cursortogglebutton, 130, 30, TRUE, TRUE, 2); 766 dw_box_pack_start(buttonbox, cursortogglebutton, 130, 30, TRUE, TRUE, 2);
687 767
688 colorchoosebutton = dw_button_new("Color Chooser Dialog", 1004L); 768 colorchoosebutton = dw_button_new("Color Chooser Dialog", 1004L);
689 dw_box_pack_start(buttonbox, colorchoosebutton, 130, 30, TRUE, TRUE, 2); 769 dw_box_pack_start(buttonbox, colorchoosebutton, 130, 30, TRUE, TRUE, 2);
690 770
691 okbutton = dw_button_new("Turn Off Annoying Beep!", 1001L); 771 okbutton = dw_button_new("Turn Off Annoying Beep!", 1001L);
692 dw_box_pack_start(buttonbox, okbutton, 130, 30, TRUE, TRUE, 2); 772 dw_box_pack_start(buttonbox, okbutton, 130, 30, TRUE, TRUE, 2);
693 773
694 cancelbutton = dw_button_new("Exit", 1002L); 774 cancelbutton = dw_button_new("Exit", 1002L);
695 dw_box_pack_start(buttonbox, cancelbutton, 130, 30, TRUE, TRUE, 2); 775 dw_box_pack_start(buttonbox, cancelbutton, 130, 30, TRUE, TRUE, 2);
696 dw_window_click_default( mainwindow, cancelbutton ); 776 dw_window_click_default( mainwindow, cancelbutton );
697 777
698 /* Set some nice fonts and colors */ 778 /* Set some nice fonts and colors */
699 dw_window_set_color(lbbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); 779 dw_window_set_color(lbbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY);
700 dw_window_set_color(buttonbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); 780 dw_window_set_color(buttonbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY);
701 dw_window_set_color(okbutton, DW_CLR_PALEGRAY, DW_CLR_DARKCYAN); 781 dw_window_set_color(okbutton, DW_CLR_PALEGRAY, DW_CLR_DARKCYAN);
702 782
703 dw_signal_connect(browsefilebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(browse_file_callback), (void *)notebookbox1); 783 dw_signal_connect(browsefilebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(browse_file_callback), (void *)notebookbox1);
704 dw_signal_connect(browsefolderbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(browse_folder_callback), (void *)notebookbox1); 784 dw_signal_connect(browsefolderbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(browse_folder_callback), (void *)notebookbox1);
705 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(beep_callback), (void *)notebookbox1); 785 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(beep_callback), (void *)notebookbox1);
706 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); 786 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow);
707 dw_signal_connect(cursortogglebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(cursortoggle_callback), (void *)mainwindow); 787 dw_signal_connect(cursortogglebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(cursortoggle_callback), (void *)mainwindow);
708 dw_signal_connect(colorchoosebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(colorchoose_callback), (void *)mainwindow); 788 dw_signal_connect(colorchoosebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(colorchoose_callback), (void *)mainwindow);
709 } 789 }
710 790
791 int API motion_notify_event(HWND window, int x, int y, int buttonmask, void *data)
792 {
793 char buf[200];
794 sprintf(buf, "%s: %dx%d", data ? "motion_notify" : "button_press", x, y);
795 dw_window_set_text(status2, buf);
796 return 0;
797 }
711 798
712 void text_add(void) 799 void text_add(void)
713 { 800 {
714 unsigned long depth = dw_color_depth_get(); 801 unsigned long depth = dw_color_depth_get();
715 HWND vscrollbox,hbox,spin1,button1; 802 HWND vscrollbox, hbox, button1;
716 803
717 /* create a box to pack into the notebook page */ 804 /* create a box to pack into the notebook page */
718 pagebox = dw_box_new(BOXHORZ, 2); 805 pagebox = dw_box_new(BOXHORZ, 2);
719 dw_box_pack_start( notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0); 806 dw_box_pack_start( notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0);
720 /* now a status area under this box */ 807 /* now a status area under this box */
721 status = dw_status_text_new("", 0); 808 hbox = dw_box_new(BOXHORZ, 1 );
722 dw_box_pack_start( notebookbox2, status, 100, 20, TRUE, FALSE, 1); 809 dw_box_pack_start( notebookbox2, hbox, 100, 20, TRUE, FALSE, 1);
723 /* a box with combobox and button */ 810 status1 = dw_status_text_new("", 0);
724 hbox = dw_box_new(BOXHORZ, 1 ); 811 dw_box_pack_start( hbox, status1, 100, 20, TRUE, FALSE, 1);
725 dw_box_pack_start( notebookbox2, hbox, 100, 20, TRUE, FALSE, 1); 812 status2 = dw_status_text_new("", 0);
726 button1 = dw_button_new( "Does nothing", 1223L ); 813 dw_box_pack_start( hbox, status2, 100, 20, TRUE, FALSE, 1);
727 dw_box_pack_start( hbox, button1, 100, 20, TRUE, FALSE, 0); 814 /* a box with combobox and button */
728 spin1 = dw_spinbutton_new( "", 0 ); 815 hbox = dw_box_new(BOXHORZ, 1 );
729 dw_box_pack_start( hbox, spin1, 100, 20, TRUE, FALSE, 0); 816 dw_box_pack_start( notebookbox2, hbox, 100, 25, TRUE, FALSE, 1);
730 dw_spinbutton_set_limits( spin1, 100, 1 ); 817 rendcombo = dw_combobox_new( "Shapes Double Buffered", 0 );
731 dw_spinbutton_set_pos( spin1, 1 ); 818 dw_box_pack_start( hbox, rendcombo, 100, 25, TRUE, FALSE, 0);
732 819 dw_listbox_append(rendcombo, "Shapes Double Buffered");
733 /* create render box for number pixmap */ 820 dw_listbox_append(rendcombo, "Shapes Direct");
734 textbox1 = dw_render_new( 100 ); 821 dw_listbox_append(rendcombo, "File Display");
735 dw_window_set_font(textbox1, FIXEDFONT); 822 button1 = dw_button_new( "Refresh", 1223L );
736 dw_font_text_extents_get(textbox1, NULL, "(g", &font_width, &font_height); 823 dw_box_pack_start( hbox, button1, 50, 25, TRUE, FALSE, 0);
737 font_width = font_width / 2; 824
738 vscrollbox = dw_box_new(BOXVERT, 0); 825 /* create render box for number pixmap */
739 dw_box_pack_start(vscrollbox, textbox1, font_width*width1, font_height*rows, FALSE, TRUE, 0); 826 textbox1 = dw_render_new( 100 );
740 dw_box_pack_start(vscrollbox, 0, (font_width*(width1+1)), SCROLLBARWIDTH, FALSE, FALSE, 0); 827 dw_window_set_font(textbox1, FIXEDFONT);
741 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); 828 dw_font_text_extents_get(textbox1, NULL, "(g", &font_width, &font_height);
742 829 font_width = font_width / 2;
743 /* pack empty space 1 character wide */ 830 vscrollbox = dw_box_new(BOXVERT, 0);
744 dw_box_pack_start(pagebox, 0, font_width, 0, FALSE, TRUE, 0); 831 dw_box_pack_start(vscrollbox, textbox1, font_width*width1, font_height*rows, FALSE, TRUE, 0);
745 832 dw_box_pack_start(vscrollbox, 0, (font_width*(width1+1)), SCROLLBARWIDTH, FALSE, FALSE, 0);
746 /* create box for filecontents and horz scrollbar */ 833 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0);
747 textboxA = dw_box_new( BOXVERT,0 ); 834
748 dw_box_pack_start( pagebox, textboxA, 0, 0, TRUE, TRUE, 0); 835 /* pack empty space 1 character wide */
749 836 dw_box_pack_start(pagebox, 0, font_width, 0, FALSE, TRUE, 0);
750 /* create render box for filecontents pixmap */ 837
751 textbox2 = dw_render_new( 101 ); 838 /* create box for filecontents and horz scrollbar */
752 dw_box_pack_start( textboxA, textbox2, 10, 10, TRUE, TRUE, 0); 839 textboxA = dw_box_new( BOXVERT,0 );
753 dw_window_set_font(textbox2, FIXEDFONT); 840 dw_box_pack_start( pagebox, textboxA, 0, 0, TRUE, TRUE, 0);
754 /* create horizonal scrollbar */ 841
755 hscrollbar = dw_scrollbar_new(FALSE, 50); 842 /* create render box for filecontents pixmap */
756 dw_box_pack_start( textboxA, hscrollbar, 100, SCROLLBARWIDTH, TRUE, FALSE, 0); 843 textbox2 = dw_render_new( 101 );
757 844 dw_box_pack_start( textboxA, textbox2, 10, 10, TRUE, TRUE, 0);
758 /* create vertical scrollbar */ 845 dw_window_set_font(textbox2, FIXEDFONT);
759 vscrollbox = dw_box_new(BOXVERT, 0); 846 /* create horizonal scrollbar */
760 vscrollbar = dw_scrollbar_new(TRUE, 50); 847 hscrollbar = dw_scrollbar_new(FALSE, 50);
761 dw_box_pack_start(vscrollbox, vscrollbar, SCROLLBARWIDTH, 100, FALSE, TRUE, 0); 848 dw_box_pack_start( textboxA, hscrollbar, 100, SCROLLBARWIDTH, TRUE, FALSE, 0);
762 /* Pack an area of empty space 14x14 pixels */ 849
763 dw_box_pack_start(vscrollbox, 0, SCROLLBARWIDTH, SCROLLBARWIDTH, FALSE, FALSE, 0); 850 /* create vertical scrollbar */
764 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); 851 vscrollbox = dw_box_new(BOXVERT, 0);
765 852 vscrollbar = dw_scrollbar_new(TRUE, 50);
766 text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, depth ); 853 dw_box_pack_start(vscrollbox, vscrollbar, SCROLLBARWIDTH, 100, FALSE, TRUE, 0);
767 text2pm = dw_pixmap_new( textbox2, font_width*cols, font_height*rows, depth ); 854 /* Pack an area of empty space 14x14 pixels */
768 855 dw_box_pack_start(vscrollbox, 0, SCROLLBARWIDTH, SCROLLBARWIDTH, FALSE, FALSE, 0);
769 dw_messagebox("DWTest", DW_MB_OK|DW_MB_INFORMATION, "Width: %d Height: %d\n", font_width, font_height); 856 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0);
770 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows); 857
771 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*cols, font_height*rows); 858 text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, (int)depth );
772 dw_signal_connect(textbox1, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL); 859 text2pm = dw_pixmap_new( textbox2, font_width*cols, font_height*rows, (int)depth );
773 dw_signal_connect(textbox2, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL); 860
774 dw_signal_connect(textbox2, DW_SIGNAL_CONFIGURE, DW_SIGNAL_FUNC(configure_event), text2pm); 861 dw_messagebox("DWTest", DW_MB_OK|DW_MB_INFORMATION, "Width: %d Height: %d\n", font_width, font_height);
775 dw_signal_connect(hscrollbar, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(scrollbar_valuechanged_callback), (void *)status); 862 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows);
776 dw_signal_connect(vscrollbar, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(scrollbar_valuechanged_callback), (void *)status); 863 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*cols, font_height*rows);
777 864 dw_signal_connect(textbox1, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL);
778 dw_signal_connect(mainwindow, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(keypress_callback), NULL); 865 dw_signal_connect(textbox2, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL);
866 dw_signal_connect(textbox2, DW_SIGNAL_CONFIGURE, DW_SIGNAL_FUNC(configure_event), text2pm);
867 dw_signal_connect(textbox2, DW_SIGNAL_MOTION_NOTIFY, DW_SIGNAL_FUNC(motion_notify_event), (void *)1);
868 dw_signal_connect(textbox2, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(motion_notify_event), (void *)0);
869 dw_signal_connect(hscrollbar, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(scrollbar_valuechanged_callback), (void *)status1);
870 dw_signal_connect(vscrollbar, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(scrollbar_valuechanged_callback), (void *)status1);
871 dw_signal_connect(button1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(refresh_callback), NULL);
872 dw_signal_connect(rendcombo, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(render_select_event_callback), NULL );
873 dw_signal_connect(mainwindow, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(keypress_callback), NULL);
779 } 874 }
780 875
781 void tree_add(void) 876 void tree_add(void)
782 { 877 {
783 HTREEITEM t1,t2,t3,t4,t5,t6; 878 HTREEITEM t1,t2,t3,t4,t5,t6;
784 HWND listbox; 879 HWND listbox;
785 880
786 /* create a box to pack into the notebook page */ 881 /* create a box to pack into the notebook page */
787 listbox = dw_listbox_new(1024, TRUE); 882 listbox = dw_listbox_new(1024, TRUE);
788 dw_box_pack_start( notebookbox3, listbox, 500, 200, TRUE, TRUE, 0); 883 dw_box_pack_start( notebookbox3, listbox, 500, 200, TRUE, TRUE, 0);
789 dw_listbox_append(listbox, "Test 1"); 884 dw_listbox_append(listbox, "Test 1");
790 dw_listbox_append(listbox, "Test 2"); 885 dw_listbox_append(listbox, "Test 2");
791 dw_listbox_append(listbox, "Test 3"); 886 dw_listbox_append(listbox, "Test 3");
792 dw_listbox_append(listbox, "Test 4"); 887 dw_listbox_append(listbox, "Test 4");
793 dw_listbox_append(listbox, "Test 5"); 888 dw_listbox_append(listbox, "Test 5");
794 889
795 /* create a box to pack into the notebook page */ 890 /* create a box to pack into the notebook page */
796 treebox = dw_box_new(BOXHORZ, 2); 891 treebox = dw_box_new(BOXHORZ, 2);
797 dw_box_pack_start( notebookbox3, treebox, 500, 200, TRUE, TRUE, 0); 892 dw_box_pack_start( notebookbox3, treebox, 500, 200, TRUE, TRUE, 0);
798 893
799 /* now a tree area under this box */ 894 /* now a tree area under this box */
800 tree = dw_tree_new(101); 895 tree = dw_tree_new(101);
801 dw_box_pack_start( notebookbox3, tree, 500, 200, TRUE, FALSE, 1); 896 dw_box_pack_start( notebookbox3, tree, 500, 200, TRUE, FALSE, 1);
802 897
803 /* and a status area to see whats going on */ 898 /* and a status area to see whats going on */
804 tree_status = dw_status_text_new("", 0); 899 tree_status = dw_status_text_new("", 0);
805 dw_box_pack_start( notebookbox3, tree_status, 100, 20, TRUE, FALSE, 1); 900 dw_box_pack_start( notebookbox3, tree_status, 100, 20, TRUE, FALSE, 1);
806 901
807 foldericon = dw_icon_load_from_file( FOLDER_ICON_NAME ); 902 foldericon = dw_icon_load_from_file( FOLDER_ICON_NAME );
808 fileicon = dw_icon_load_from_file( FILE_ICON_NAME ); 903 fileicon = dw_icon_load_from_file( FILE_ICON_NAME );
809 904
810 /* set up our signal trappers... */ 905 /* set up our signal trappers... */
811 dw_signal_connect(tree, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), (void *)tree_status); 906 dw_signal_connect(tree, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), (void *)tree_status);
812 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(item_select_cb), (void *)tree_status); 907 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(item_select_cb), (void *)tree_status);
813 908
814 t1 = dw_tree_insert(tree, "tree folder 1", foldericon, NULL, (void *)1 ); 909 t1 = dw_tree_insert(tree, "tree folder 1", foldericon, NULL, (void *)1 );
815 t2 = dw_tree_insert(tree, "tree folder 2", foldericon, NULL, (void *)2 ); 910 t2 = dw_tree_insert(tree, "tree folder 2", foldericon, NULL, (void *)2 );
816 t3 = dw_tree_insert(tree, "tree file 1", fileicon, t1, (void *)3 ); 911 t3 = dw_tree_insert(tree, "tree file 1", fileicon, t1, (void *)3 );
817 t4 = dw_tree_insert(tree, "tree file 2", fileicon, t1, (void *)4 ); 912 t4 = dw_tree_insert(tree, "tree file 2", fileicon, t1, (void *)4 );
818 t5 = dw_tree_insert(tree, "tree file 3", fileicon, t2, (void *)5 ); 913 t5 = dw_tree_insert(tree, "tree file 3", fileicon, t2, (void *)5 );
819 t6 = dw_tree_insert(tree, "tree file 4", fileicon, t2, (void *)6 ); 914 t6 = dw_tree_insert(tree, "tree file 4", fileicon, t2, (void *)6 );
820 /* set the folder name and icon again to show error with dw_tree_item_change under GTK 2.0 */ 915 /* set the folder name and icon again to show error with dw_tree_item_change under GTK 2.0 */
821 dw_tree_item_change(tree, t1, "tree folder 1", foldericon ); 916 dw_tree_item_change(tree, t1, "tree folder 1", foldericon );
822 dw_tree_item_change(tree, t2, "tree folder 2", foldericon ); 917 dw_tree_item_change(tree, t2, "tree folder 2", foldericon );
823 } 918 }
824 919
825 void container_add(void) 920 void container_add(void)
826 { 921 {
827 char *titles[4]; 922 char *titles[4];
828 char *names[3]; 923 char *names[3];
829 char buffer[100]; 924 char buffer[100];
830 unsigned long flags[4] = { DW_CFA_BITMAPORICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, 925 unsigned long flags[4] = { DW_CFA_BITMAPORICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR,
831 DW_CFA_ULONG | DW_CFA_RIGHT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, 926 DW_CFA_ULONG | DW_CFA_RIGHT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR,
832 DW_CFA_TIME | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, 927 DW_CFA_TIME | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR,
833 DW_CFA_DATE | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR }; 928 DW_CFA_DATE | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR };
834 int z; 929 int z;
835 CTIME time; 930 CTIME time;
836 CDATE date; 931 CDATE date;
837 unsigned long size; 932 unsigned long size;
838 HICN thisicon; 933 HICN thisicon;
839 934
840 /* create a box to pack into the notebook page */ 935 /* create a box to pack into the notebook page */
841 containerbox = dw_box_new(BOXHORZ, 2); 936 containerbox = dw_box_new(BOXHORZ, 2);
842 dw_box_pack_start( notebookbox4, containerbox, 500, 200, TRUE, TRUE, 0); 937 dw_box_pack_start( notebookbox4, containerbox, 500, 200, TRUE, TRUE, 0);
843 938
844 /* now a container area under this box */ 939 /* now a container area under this box */
845 container = dw_container_new(100, TRUE); 940 container = dw_container_new(100, TRUE);
846 dw_box_pack_start( notebookbox4, container, 500, 200, TRUE, FALSE, 1); 941 dw_box_pack_start( notebookbox4, container, 500, 200, TRUE, FALSE, 1);
847 942
848 /* and a status area to see whats going on */ 943 /* and a status area to see whats going on */
849 container_status = dw_status_text_new("", 0); 944 container_status = dw_status_text_new("", 0);
850 dw_box_pack_start( notebookbox4, container_status, 100, 20, TRUE, FALSE, 1); 945 dw_box_pack_start( notebookbox4, container_status, 100, 20, TRUE, FALSE, 1);
851 946
852 titles[0] = "Type"; 947 titles[0] = "Type";
853 titles[1] = "Size"; 948 titles[1] = "Size";
854 titles[2] = "Time"; 949 titles[2] = "Time";
855 titles[3] = "Date"; 950 titles[3] = "Date";
856 951
857 dw_filesystem_setup(container, flags, titles, 4); 952 dw_filesystem_setup(container, flags, titles, 4);
858 containerinfo = dw_container_alloc(container, 3); 953 containerinfo = dw_container_alloc(container, 3);
859 954
860 for(z=0;z<3;z++) 955 for(z=0;z<3;z++)
861 { 956 {
862 names[z] = (char *)malloc( 100 ); 957 names[z] = (char *)malloc( 100 );
863 /* yes, there is a memory leak here */ 958 /* yes, there is a memory leak here */
864 sprintf(names[z],"Don't allocate from stack: Item: %d",z); 959 sprintf(names[z],"Don't allocate from stack: Item: %d",z);
865 size = z*100; 960 size = z*100;
866 sprintf(buffer, "Filename %d",z+1); 961 sprintf(buffer, "Filename %d",z+1);
867 if (z == 0 ) thisicon = foldericon; 962 if (z == 0 ) thisicon = foldericon;
868 else thisicon = fileicon; 963 else thisicon = fileicon;
869 fprintf(stderr,"Initial: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)thisicon); 964 fprintf(stderr,"Initial: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)thisicon);
870 dw_filesystem_set_file(container, containerinfo, z, buffer, thisicon); 965 dw_filesystem_set_file(container, containerinfo, z, buffer, thisicon);
871 dw_filesystem_set_item(container, containerinfo, 0, z, &thisicon); 966 dw_filesystem_set_item(container, containerinfo, 0, z, &thisicon);
872 dw_filesystem_set_item(container, containerinfo, 1, z, &size); 967 dw_filesystem_set_item(container, containerinfo, 1, z, &size);
873 968
874 time.seconds = z+10; 969 time.seconds = z+10;
875 time.minutes = z+10; 970 time.minutes = z+10;
876 time.hours = z+10; 971 time.hours = z+10;
877 dw_filesystem_set_item(container, containerinfo, 2, z, &time); 972 dw_filesystem_set_item(container, containerinfo, 2, z, &time);
878 973
879 date.day = z+10; 974 date.day = z+10;
880 date.month = z+10; 975 date.month = z+10;
881 date.year = z+2000; 976 date.year = z+2000;
882 dw_filesystem_set_item(container, containerinfo, 3, z, &date); 977 dw_filesystem_set_item(container, containerinfo, 3, z, &date);
883 978
884 dw_container_set_row_title(containerinfo, z, names[z]); 979 dw_container_set_row_title(containerinfo, z, names[z]);
885 } 980 }
886 981
887 dw_container_insert(container, containerinfo, 3); 982 dw_container_insert(container, containerinfo, 3);
888 983
889 containerinfo = dw_container_alloc(container, 1); 984 containerinfo = dw_container_alloc(container, 1);
890 dw_filesystem_set_file(container, containerinfo, 0, strdup("Yikes"), foldericon); 985 dw_filesystem_set_file(container, containerinfo, 0, strdup("Yikes"), foldericon);
891 size = 324; 986 size = 324;
892 dw_filesystem_set_item(container, containerinfo, 0, 0, &foldericon); 987 dw_filesystem_set_item(container, containerinfo, 0, 0, &foldericon);
893 dw_filesystem_set_item(container, containerinfo, 1, 0, &size); 988 dw_filesystem_set_item(container, containerinfo, 1, 0, &size);
894 dw_filesystem_set_item(container, containerinfo, 2, 0, &time); 989 dw_filesystem_set_item(container, containerinfo, 2, 0, &time);
895 dw_filesystem_set_item(container, containerinfo, 3, 0, &date); 990 dw_filesystem_set_item(container, containerinfo, 3, 0, &date);
896 dw_container_set_row_title(containerinfo, 0, strdup("Extra")); 991 dw_container_set_row_title(containerinfo, 0, strdup("Extra"));
897 992
898 dw_container_insert(container, containerinfo, 1); 993 dw_container_insert(container, containerinfo, 1);
899 dw_container_optimize(container); 994 dw_container_optimize(container);
900 995
901 container_mle = dw_mle_new( 111 ); 996 container_mle = dw_mle_new( 111 );
902 dw_box_pack_start( containerbox, container_mle, 500, 200, TRUE, TRUE, 0); 997 dw_box_pack_start( containerbox, container_mle, 500, 200, TRUE, TRUE, 0);
903 998
904 /* connect our event trappers... */ 999 /* connect our event trappers... */
905 dw_signal_connect(container, DW_SIGNAL_ITEM_ENTER, DW_SIGNAL_FUNC(item_enter_cb), (void *)container_status); 1000 dw_signal_connect(container, DW_SIGNAL_ITEM_ENTER, DW_SIGNAL_FUNC(item_enter_cb), (void *)container_status);
906 dw_signal_connect(container, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), (void *)container_status); 1001 dw_signal_connect(container, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), (void *)container_status);
907 dw_signal_connect(container, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(container_select_cb), (void *)container_status); 1002 dw_signal_connect(container, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(container_select_cb), (void *)container_status);
908 dw_signal_connect(container, DW_SIGNAL_COLUMN_CLICK, DW_SIGNAL_FUNC(column_click_cb), (void *)container_status); 1003 dw_signal_connect(container, DW_SIGNAL_COLUMN_CLICK, DW_SIGNAL_FUNC(column_click_cb), (void *)container_status);
909 } 1004 }
910 1005
911 /* Beep every second */ 1006 /* Beep every second */
912 int DWSIGNAL timer_callback(void *data) 1007 int DWSIGNAL timer_callback(void *data)
913 { 1008 {
914 dw_beep(200, 200); 1009 dw_beep(200, 200);
915 1010
916 /* Return TRUE so we get called again */ 1011 /* Return TRUE so we get called again */
917 return TRUE; 1012 return TRUE;
918 } 1013 }
919 1014
920 1015
921 void buttons_add(void) 1016 void buttons_add(void)
922 { 1017 {
923 HWND abutton1,abutton2,calbox; 1018 HWND abutton1,abutton2,calbox;
924 int i; 1019 int i;
925 char **text; 1020 char **text;
926 1021
927 /* create a box to pack into the notebook page */ 1022 /* create a box to pack into the notebook page */
928 buttonsbox = dw_box_new(BOXVERT, 2); 1023 buttonsbox = dw_box_new(BOXVERT, 2);
929 dw_box_pack_start( notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0); 1024 dw_box_pack_start( notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0);
930 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED); 1025 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED);
931 1026
932 calbox = dw_box_new(DW_HORZ, 0); 1027 calbox = dw_box_new(DW_HORZ, 0);
933 dw_box_pack_start(notebookbox5, calbox, 500, 200, TRUE, TRUE, 1); 1028 dw_box_pack_start(notebookbox5, calbox, 500, 200, TRUE, TRUE, 1);
934 cal = dw_calendar_new(100); 1029 cal = dw_calendar_new(100);
935 dw_box_pack_start(calbox, cal, 180, 160, TRUE, TRUE, 0); 1030 dw_box_pack_start(calbox, cal, 180, 160, TRUE, TRUE, 0);
936 /* 1031 /*
937 dw_calendar_set_date(cal, 2001, 1, 1); 1032 dw_calendar_set_date(cal, 2001, 1, 1);
938 */ 1033 */
939 /* 1034 /*
940 * Create our file toolbar boxes... 1035 * Create our file toolbar boxes...
941 */ 1036 */
942 buttonboxperm = dw_box_new( BOXVERT, 0 ); 1037 buttonboxperm = dw_box_new( BOXVERT, 0 );
943 dw_box_pack_start( buttonsbox, buttonboxperm, 25, 0, FALSE, TRUE, 2 ); 1038 dw_box_pack_start( buttonsbox, buttonboxperm, 25, 0, FALSE, TRUE, 2 );
944 dw_window_set_color(buttonboxperm, DW_CLR_WHITE, DW_CLR_WHITE); 1039 dw_window_set_color(buttonboxperm, DW_CLR_WHITE, DW_CLR_WHITE);
945 // abutton1 = dw_bitmapbutton_new_from_file( "Top Button", 0, FILE_ICON_NAME ); 1040 // abutton1 = dw_bitmapbutton_new_from_file( "Top Button", 0, FILE_ICON_NAME );
946 abutton1 = dw_bitmapbutton_new_from_file( "Top Button", 0, "z:\\projects\\RexxGd\\regina\\tile_up.png" ); 1041 abutton1 = dw_bitmapbutton_new_from_file( "Top Button", 0, "z:\\projects\\RexxGd\\regina\\tile_up.png" );
947 dw_box_pack_start( buttonboxperm, abutton1, 100, 30, FALSE, FALSE, 0 ); 1042 dw_box_pack_start( buttonboxperm, abutton1, 100, 30, FALSE, FALSE, 0 );
948 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); 1043 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL );
949 dw_box_pack_start( buttonboxperm, 0, 25, 5, FALSE, FALSE, 0 ); 1044 dw_box_pack_start( buttonboxperm, 0, 25, 5, FALSE, FALSE, 0 );
950 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, FOLDER_ICON_NAME ); 1045 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, FOLDER_ICON_NAME );
951 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 ); 1046 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 );
952 dw_signal_connect( abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); 1047 dw_signal_connect( abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL );
953 1048
954 create_button(0); 1049 create_button(0);
955 /* make a combobox */ 1050 /* make a combobox */
956 combox = dw_box_new(BOXVERT, 2); 1051 combox = dw_box_new(BOXVERT, 2);
957 dw_box_pack_start( notebookbox5, combox, 25, 200, TRUE, TRUE, 0); 1052 dw_box_pack_start( notebookbox5, combox, 25, 200, TRUE, TRUE, 0);
958 combobox1 = dw_combobox_new( "fred", 0 ); /* no point in specifying an initial value */ 1053 combobox1 = dw_combobox_new( "fred", 0 ); /* no point in specifying an initial value */
959 dw_listbox_append( combobox1, "fred" ); 1054 dw_listbox_append( combobox1, "fred" );
960 dw_box_pack_start( combox, combobox1, 200, 20, TRUE, FALSE, 0); 1055 dw_box_pack_start( combox, combobox1, 200, 20, TRUE, FALSE, 0);
961 /* 1056 /*
962 dw_window_set_text( combobox, "initial value"); 1057 dw_window_set_text( combobox, "initial value");
963 */ 1058 */
964 dw_signal_connect( combobox1, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL ); 1059 dw_signal_connect( combobox1, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL );
965 #if 0 1060 #if 0
966 /* add LOTS of items */ 1061 /* add LOTS of items */
967 fprintf(stderr,"before appending 100 items to combobox using dw_listbox_append()\n"); 1062 fprintf(stderr,"before appending 100 items to combobox using dw_listbox_append()\n");
968 for( i = 0; i < 100; i++ ) 1063 for( i = 0; i < 100; i++ )
969 { 1064 {
970 sprintf( buf, "item %d", i); 1065 sprintf( buf, "item %d", i);
971 dw_listbox_append( combobox1, buf ); 1066 dw_listbox_append( combobox1, buf );
972 } 1067 }
973 fprintf(stderr,"after appending 100 items to combobox\n"); 1068 fprintf(stderr,"after appending 100 items to combobox\n");
974 #endif 1069 #endif
975 1070
976 combobox2 = dw_combobox_new( "joe", 0 ); /* no point in specifying an initial value */ 1071 combobox2 = dw_combobox_new( "joe", 0 ); /* no point in specifying an initial value */
977 dw_box_pack_start( combox, combobox2, 200, 20, TRUE, FALSE, 0); 1072 dw_box_pack_start( combox, combobox2, 200, 20, TRUE, FALSE, 0);
978 /* 1073 /*
979 dw_window_set_text( combobox, "initial value"); 1074 dw_window_set_text( combobox, "initial value");
980 */ 1075 */
981 dw_signal_connect( combobox2, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL ); 1076 dw_signal_connect( combobox2, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL );
982 /* add LOTS of items */ 1077 /* add LOTS of items */
983 fprintf(stderr,"before appending 500 items to combobox using dw_listbox_list_append()\n"); 1078 fprintf(stderr,"before appending 500 items to combobox using dw_listbox_list_append()\n");
984 text = (char **)malloc(500*sizeof(char *)); 1079 text = (char **)malloc(500*sizeof(char *));
985 for( i = 0; i < 500; i++ ) 1080 for( i = 0; i < 500; i++ )
986 { 1081 {
987 text[i] = (char *)malloc( 50 ); 1082 text[i] = (char *)malloc( 50 );
988 sprintf( text[i], "item %d", i); 1083 sprintf( text[i], "item %d", i);
989 } 1084 }
990 dw_listbox_list_append( combobox2, text, 500 ); 1085 dw_listbox_list_append( combobox2, text, 500 );
991 fprintf(stderr,"after appending 500 items to combobox\n"); 1086 fprintf(stderr,"after appending 500 items to combobox\n");
992 for( i = 0; i < 500; i++ ) 1087 for( i = 0; i < 500; i++ )
993 { 1088 {
994 free(text[i]); 1089 free(text[i]);
995 } 1090 }
996 free(text); 1091 free(text);
997 /* now insert a couple of items */ 1092 /* now insert a couple of items */
998 dw_listbox_insert( combobox2, "inserted item 2", 2 ); 1093 dw_listbox_insert( combobox2, "inserted item 2", 2 );
999 dw_listbox_insert( combobox2, "inserted item 5", 5 ); 1094 dw_listbox_insert( combobox2, "inserted item 5", 5 );
1000 /* make a spinbutton */ 1095 /* make a spinbutton */
1001 spinbutton = dw_spinbutton_new( "", 0 ); /* no point in specifying text */ 1096 spinbutton = dw_spinbutton_new( "", 0 ); /* no point in specifying text */
1002 dw_box_pack_start( combox, spinbutton, 200, 20, TRUE, FALSE, 0); 1097 dw_box_pack_start( combox, spinbutton, 200, 20, TRUE, FALSE, 0);
1003 dw_spinbutton_set_limits( spinbutton, 100, 1 ); 1098 dw_spinbutton_set_limits( spinbutton, 100, 1 );
1004 dw_spinbutton_set_pos( spinbutton, 30 ); 1099 dw_spinbutton_set_pos( spinbutton, 30 );
1005 dw_signal_connect( spinbutton, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(spinbutton_valuechanged_callback), NULL ); 1100 dw_signal_connect( spinbutton, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(spinbutton_valuechanged_callback), NULL );
1006 /* make a slider */ 1101 /* make a slider */
1007 slider = dw_slider_new( FALSE, 10, 0 ); /* no point in specifying text */ 1102 slider = dw_slider_new( FALSE, 10, 0 ); /* no point in specifying text */
1008 dw_box_pack_start( combox, slider, 200, 20, TRUE, FALSE, 0); 1103 dw_box_pack_start( combox, slider, 200, 20, TRUE, FALSE, 0);
1009 dw_signal_connect( slider, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(slider_valuechanged_callback), NULL ); 1104 dw_signal_connect( slider, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(slider_valuechanged_callback), NULL );
1010 } 1105 }
1011 1106
1012 void create_button( int redraw) 1107 void create_button( int redraw)
1013 { 1108 {
1014 HWND abutton1; 1109 HWND abutton1;
1015 filetoolbarbox = dw_box_new( BOXVERT, 0 ); 1110 filetoolbarbox = dw_box_new( BOXVERT, 0 );
1016 dw_box_pack_start( buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0 ); 1111 dw_box_pack_start( buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0 );
1017 1112
1018 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); 1113 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" );
1019 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1114 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
1020 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_red_callback), NULL ); 1115 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_red_callback), NULL );
1021 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); 1116 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 );
1022 1117
1023 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); 1118 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" );
1024 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1119 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
1025 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_yellow_callback), NULL ); 1120 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_yellow_callback), NULL );
1026 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); 1121 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 );
1027 1122
1028 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); 1123 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" );
1029 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1124 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
1030 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(redraw_button_box_callback), NULL ); 1125 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(redraw_button_box_callback), NULL );
1031 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); 1126 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 );
1032 if ( redraw ) 1127 if ( redraw )
1033 { 1128 {
1034 dw_window_redraw( filetoolbarbox ); 1129 dw_window_redraw( filetoolbarbox );
1035 dw_window_redraw( mainwindow ); 1130 dw_window_redraw( mainwindow );
1036 } 1131 }
1037 } 1132 }
1038 1133
1039 void mdi_add(void) 1134 void mdi_add(void)
1040 { 1135 {
1041 HWND mdibox, mdi, mdi1w, mdi1box, ef, mdi2w, mdi2box, bb; 1136 HWND mdibox, mdi, mdi1w, mdi1box, ef, mdi2w, mdi2box, bb;
1042 1137
1043 /* create a box to pack into the notebook page */ 1138 /* create a box to pack into the notebook page */
1044 mdibox = dw_box_new(DW_HORZ, 0); 1139 mdibox = dw_box_new(DW_HORZ, 0);
1045 1140
1046 dw_box_pack_start(notebookbox6, mdibox, 500, 200, TRUE, TRUE, 1); 1141 dw_box_pack_start(notebookbox6, mdibox, 500, 200, TRUE, TRUE, 1);
1047 1142
1048 /* now a mdi under this box */ 1143 /* now a mdi under this box */
1049 mdi = dw_mdi_new(333); 1144 mdi = dw_mdi_new(333);
1050 dw_box_pack_start(mdibox, mdi, 500, 200, TRUE, TRUE, 2); 1145 dw_box_pack_start(mdibox, mdi, 500, 200, TRUE, TRUE, 2);
1051 1146
1052 mdi1w = dw_window_new(mdi, "MDI1", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); 1147 mdi1w = dw_window_new(mdi, "MDI1", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX);
1053 mdi1box = dw_box_new(DW_HORZ, 0); 1148 mdi1box = dw_box_new(DW_HORZ, 0);
1054 dw_box_pack_start(mdi1w, mdi1box, 0, 0, TRUE, TRUE, 0); 1149 dw_box_pack_start(mdi1w, mdi1box, 0, 0, TRUE, TRUE, 0);
1055 ef = dw_entryfield_new("", 0); 1150 ef = dw_entryfield_new("", 0);
1056 dw_box_pack_start(mdi1box, ef, 100, 20, FALSE, FALSE, 4); 1151 dw_box_pack_start(mdi1box, ef, 100, 20, FALSE, FALSE, 4);
1057 dw_window_set_size(mdi1w, 200, 100); 1152 dw_window_set_size(mdi1w, 200, 100);
1058 dw_window_show(mdi1w); 1153 dw_window_show(mdi1w);
1059 1154
1060 mdi2w = dw_window_new(mdi, "MDI2", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); 1155 mdi2w = dw_window_new(mdi, "MDI2", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX);
1061 mdi2box = dw_box_new(DW_HORZ, 0); 1156 mdi2box = dw_box_new(DW_HORZ, 0);
1062 dw_box_pack_start(mdi2w, mdi2box, 0, 0, TRUE, TRUE, 0); 1157 dw_box_pack_start(mdi2w, mdi2box, 0, 0, TRUE, TRUE, 0);
1063 ef = dw_entryfield_new( "", 0); 1158 ef = dw_entryfield_new( "", 0);
1064 dw_box_pack_start(mdi2box, ef, 150, 30, FALSE, FALSE, 4); 1159 dw_box_pack_start(mdi2box, ef, 150, 30, FALSE, FALSE, 4);
1065 bb = dw_button_new("Browse", 0); 1160 bb = dw_button_new("Browse", 0);
1066 dw_box_pack_start(mdi2box, bb, 60, 30, FALSE, FALSE, 4); 1161 dw_box_pack_start(mdi2box, bb, 60, 30, FALSE, FALSE, 4);
1067 dw_window_set_size(mdi2w, 200, 200); 1162 dw_window_set_size(mdi2w, 200, 200);
1068 dw_window_show(mdi2w); 1163 dw_window_show(mdi2w);
1069 } 1164 }
1070 1165
1071 void menu_add(void) 1166 void menu_add(void)
1072 { 1167 {
1073 HMENUI menuitem,menu; 1168 HMENUI menuitem,menu;
1074 1169
1075 mainmenubar = dw_menubar_new( mainwindow ); 1170 mainmenubar = dw_menubar_new( mainwindow );
1076 /* add menus to the menubar */ 1171 /* add menus to the menubar */
1077 menu = dw_menu_new( 0 ); 1172 menu = dw_menu_new( 0 );
1078 menuitem = dw_menu_append_item( menu, "~Quit", 1019, 0, TRUE, FALSE, 0 ); 1173 menuitem = dw_menu_append_item( menu, "~Quit", 1019, 0, TRUE, FALSE, 0 );
1079 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); 1174 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow);
1080 /* 1175 /*
1081 * Add the "File" menu to the menubar... 1176 * Add the "File" menu to the menubar...
1082 */ 1177 */
1083 dw_menu_append_item( mainmenubar, "~File", 1010, 0, TRUE, FALSE, menu ); 1178 dw_menu_append_item( mainmenubar, "~File", 1010, 0, TRUE, FALSE, menu );
1084 1179
1085 changeable_menu = dw_menu_new( 0 ); 1180 changeable_menu = dw_menu_new( 0 );
1086 checkable_menuitem = dw_menu_append_item( changeable_menu, "~Checkable Menu Item", CHECKABLE_MENUITEMID, 0, TRUE, TRUE, 0 ); 1181 checkable_menuitem = dw_menu_append_item( changeable_menu, "~Checkable Menu Item", CHECKABLE_MENUITEMID, 0, TRUE, TRUE, 0 );
1087 dw_signal_connect( checkable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), (void *)"checkable"); 1182 dw_signal_connect( checkable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), (void *)"checkable");
1088 noncheckable_menuitem = dw_menu_append_item( changeable_menu, "~Non-checkable Menu Item", NONCHECKABLE_MENUITEMID, 0, TRUE, FALSE, 0 ); 1183 noncheckable_menuitem = dw_menu_append_item( changeable_menu, "~Non-checkable Menu Item", NONCHECKABLE_MENUITEMID, 0, TRUE, FALSE, 0 );
1089 dw_signal_connect( noncheckable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), (void *)"non-checkable"); 1184 dw_signal_connect( noncheckable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), (void *)"non-checkable");
1090 menuitem = dw_menu_append_item( changeable_menu, "~Disabled menu Item", 2003, DW_MIS_DISABLED|DW_MIS_CHECKED, TRUE, TRUE, 0 ); 1185 menuitem = dw_menu_append_item( changeable_menu, "~Disabled menu Item", 2003, DW_MIS_DISABLED|DW_MIS_CHECKED, TRUE, TRUE, 0 );
1091 /* seperator */ 1186 /* seperator */
1092 dw_menu_append_item( changeable_menu, DW_MENU_SEPARATOR, 3999, 0, TRUE, FALSE, 0 ); 1187 dw_menu_append_item( changeable_menu, DW_MENU_SEPARATOR, 3999, 0, TRUE, FALSE, 0 );
1093 menuitem = dw_menu_append_item( changeable_menu, "~Menu Items Disabled", 2009, 0, TRUE, TRUE, 0 ); 1188 menuitem = dw_menu_append_item( changeable_menu, "~Menu Items Disabled", 2009, 0, TRUE, TRUE, 0 );
1094 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menutoggle_callback), (void *)NULL); 1189 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menutoggle_callback), (void *)NULL);
1095 /* 1190 /*
1096 * Add the "Menu" menu to the menubar... 1191 * Add the "Menu" menu to the menubar...
1097 */ 1192 */
1098 dw_menu_append_item( mainmenubar, "~Menu", 1020, 0, TRUE, FALSE, changeable_menu ); 1193 dw_menu_append_item( mainmenubar, "~Menu", 1020, 0, TRUE, FALSE, changeable_menu );
1099 1194
1100 menu = dw_menu_new( 0 ); 1195 menu = dw_menu_new( 0 );
1101 menuitem = dw_menu_append_item( menu, "~About", 1091, 0, TRUE, FALSE, 0 ); 1196 menuitem = dw_menu_append_item( menu, "~About", 1091, 0, TRUE, FALSE, 0 );
1102 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(helpabout_callback), (void *)mainwindow); 1197 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(helpabout_callback), (void *)mainwindow);
1103 /* 1198 /*
1104 * Add the "Help" menu to the menubar... 1199 * Add the "Help" menu to the menubar...
1105 */ 1200 */
1106 dw_menu_append_item( mainmenubar, "~Help", 1090, 0, TRUE, FALSE, menu ); 1201 dw_menu_append_item( mainmenubar, "~Help", 1090, 0, TRUE, FALSE, menu );
1107 } 1202 }
1108 1203
1109 int DWSIGNAL scrollbox_button_callback(HWND window, void *data) 1204 int DWSIGNAL scrollbox_button_callback(HWND window, void *data)
1110 { 1205 {
1111 int pos, range; 1206 int pos, range;
1112 1207
1113 pos = dw_scrollbox_get_pos( scrollbox, DW_VERT ); 1208 pos = dw_scrollbox_get_pos( scrollbox, DW_VERT );
1114 range = dw_scrollbox_get_range( scrollbox, DW_VERT ); 1209 range = dw_scrollbox_get_range( scrollbox, DW_VERT );
1115 fprintf( stderr, "Pos %d Range %d\n", pos, range ); 1210 fprintf( stderr, "Pos %d Range %d\n", pos, range );
1116 return 0; 1211 return 0;
1117 } 1212 }
1118 1213
1119 void scrollbox_add(void) 1214 void scrollbox_add(void)
1120 { 1215 {
1121 HWND tmpbox,abutton1; 1216 HWND tmpbox,abutton1;
1122 char buf[100]; 1217 char buf[100];
1123 int i; 1218 int i;
1124 1219
1125 /* create a box to pack into the notebook page */ 1220 /* create a box to pack into the notebook page */
1126 scrollbox = dw_scrollbox_new(DW_VERT, 0); 1221 scrollbox = dw_scrollbox_new(DW_VERT, 0);
1127 dw_box_pack_start(notebookbox8, scrollbox, 0, 0, TRUE, TRUE, 1); 1222 dw_box_pack_start(notebookbox8, scrollbox, 0, 0, TRUE, TRUE, 1);
1128 1223
1129 abutton1 = dw_button_new( "Show Adjustments", 0 ); 1224 abutton1 = dw_button_new( "Show Adjustments", 0 );
1130 dw_box_pack_start( scrollbox, abutton1, 100, 30, FALSE, FALSE, 0 ); 1225 dw_box_pack_start( scrollbox, abutton1, 100, 30, FALSE, FALSE, 0 );
1131 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(scrollbox_button_callback), NULL ); 1226 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(scrollbox_button_callback), NULL );
1132 1227
1133 for ( i = 0; i < MAX_WIDGETS; i++ ) 1228 for ( i = 0; i < MAX_WIDGETS; i++ )
1134 { 1229 {
1135 tmpbox = dw_box_new( DW_HORZ, 0 ); 1230 tmpbox = dw_box_new( DW_HORZ, 0 );
1136 dw_box_pack_start( scrollbox, tmpbox, 0, 24, TRUE, FALSE, 2); 1231 dw_box_pack_start( scrollbox, tmpbox, 0, 24, TRUE, FALSE, 2);
1137 sprintf( buf, "Label %d", i ); 1232 sprintf( buf, "Label %d", i );
1138 labelarray[i] = dw_text_new( buf , 0 ); 1233 labelarray[i] = dw_text_new( buf , 0 );
1139 dw_box_pack_start( tmpbox, labelarray[i], 0, 20, TRUE, FALSE, 0); 1234 dw_box_pack_start( tmpbox, labelarray[i], 0, 20, TRUE, FALSE, 0);
1140 sprintf( buf, "Entry %d", i ); 1235 sprintf( buf, "Entry %d", i );
1141 entryarray[i] = dw_entryfield_new( buf , i ); 1236 entryarray[i] = dw_entryfield_new( buf , i );
1142 dw_box_pack_start( tmpbox, entryarray[i], 0, 20, TRUE, FALSE, 0); 1237 dw_box_pack_start( tmpbox, entryarray[i], 0, 20, TRUE, FALSE, 0);
1143 } 1238 }
1144 } 1239 }
1145 1240
1146 /* 1241 /*
1147 * Let's demonstrate the functionality of this library. :) 1242 * Let's demonstrate the functionality of this library. :)
1148 */ 1243 */
1149 int main(int argc, char *argv[]) 1244 int main(int argc, char *argv[])
1150 { 1245 {
1151 ULONG notebookpage1; 1246 ULONG notebookpage1;
1152 ULONG notebookpage2; 1247 ULONG notebookpage2;
1153 ULONG notebookpage3; 1248 ULONG notebookpage3;
1154 ULONG notebookpage4; 1249 ULONG notebookpage4;
1155 ULONG notebookpage5; 1250 ULONG notebookpage5;
1156 ULONG notebookpage6; 1251 ULONG notebookpage6;
1157 ULONG notebookpage7; 1252 ULONG notebookpage7;
1158 ULONG notebookpage8; 1253 ULONG notebookpage8;
1159 1254
1160 dw_init(TRUE, argc, argv); 1255 dw_init(TRUE, argc, argv);
1161 1256
1162 mainwindow = dw_window_new( HWND_DESKTOP, "dwindows test", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); 1257 mainwindow = dw_window_new( HWND_DESKTOP, "dwindows test", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX);
1163 dw_window_set_icon(mainwindow, fileicon); 1258 dw_window_set_icon(mainwindow, fileicon);
1164 1259
1165 notebookbox = dw_box_new( BOXVERT, 5 ); 1260 notebookbox = dw_box_new( BOXVERT, 5 );
1166 dw_box_pack_start( mainwindow, notebookbox, 0, 0, TRUE, TRUE, 0); 1261 dw_box_pack_start( mainwindow, notebookbox, 0, 0, TRUE, TRUE, 0);
1167 /* MUST pack a box into the mainwindow BEFORE adding menus */ 1262 /* MUST pack a box into the mainwindow BEFORE adding menus */
1168 menu_add(); 1263 menu_add();
1169 1264
1170 notebook = dw_notebook_new( 1, TRUE ); 1265 notebook = dw_notebook_new( 1, TRUE );
1171 dw_box_pack_start( notebookbox, notebook, 100, 100, TRUE, TRUE, 0); 1266 dw_box_pack_start( notebookbox, notebook, 100, 100, TRUE, TRUE, 0);
1172 dw_signal_connect(notebook, DW_SIGNAL_SWITCH_PAGE, DW_SIGNAL_FUNC(switch_page_cb), NULL); 1267 dw_signal_connect(notebook, DW_SIGNAL_SWITCH_PAGE, DW_SIGNAL_FUNC(switch_page_cb), NULL);
1173 1268
1174 notebookbox1 = dw_box_new( BOXVERT, 5 ); 1269 notebookbox1 = dw_box_new( BOXVERT, 5 );
1175 notebookpage1 = dw_notebook_page_new( notebook, 0, TRUE ); 1270 notebookpage1 = dw_notebook_page_new( notebook, 0, TRUE );
1176 dw_notebook_pack( notebook, notebookpage1, notebookbox1 ); 1271 dw_notebook_pack( notebook, notebookpage1, notebookbox1 );
1177 dw_notebook_page_set_text( notebook, notebookpage1, "buttons and entry"); 1272 dw_notebook_page_set_text( notebook, notebookpage1, "buttons and entry");
1178 archive_add(); 1273 archive_add();
1179 1274
1180 notebookbox2 = dw_box_new( BOXVERT, 5 ); 1275 notebookbox2 = dw_box_new( BOXVERT, 5 );
1181 notebookpage2 = dw_notebook_page_new( notebook, 1, FALSE ); 1276 notebookpage2 = dw_notebook_page_new( notebook, 1, FALSE );
1182 dw_notebook_pack( notebook, notebookpage2, notebookbox2 ); 1277 dw_notebook_pack( notebook, notebookpage2, notebookbox2 );
1183 dw_notebook_page_set_text( notebook, notebookpage2, "render"); 1278 dw_notebook_page_set_text( notebook, notebookpage2, "render");
1184 text_add(); 1279 text_add();
1185 1280
1186 notebookbox3 = dw_box_new( BOXVERT, 5 ); 1281 notebookbox3 = dw_box_new( BOXVERT, 5 );
1187 notebookpage3 = dw_notebook_page_new( notebook, 1, FALSE ); 1282 notebookpage3 = dw_notebook_page_new( notebook, 1, FALSE );
1188 dw_notebook_pack( notebook, notebookpage3, notebookbox3 ); 1283 dw_notebook_pack( notebook, notebookpage3, notebookbox3 );
1189 dw_notebook_page_set_text( notebook, notebookpage3, "tree"); 1284 dw_notebook_page_set_text( notebook, notebookpage3, "tree");
1190 tree_add(); 1285 tree_add();
1191 1286
1192 notebookbox4 = dw_box_new( BOXVERT, 5 ); 1287 notebookbox4 = dw_box_new( BOXVERT, 5 );
1193 notebookpage4 = dw_notebook_page_new( notebook, 1, FALSE ); 1288 notebookpage4 = dw_notebook_page_new( notebook, 1, FALSE );
1194 dw_notebook_pack( notebook, notebookpage4, notebookbox4 ); 1289 dw_notebook_pack( notebook, notebookpage4, notebookbox4 );
1195 dw_notebook_page_set_text( notebook, notebookpage4, "container"); 1290 dw_notebook_page_set_text( notebook, notebookpage4, "container");
1196 container_add(); 1291 container_add();
1197 1292
1198 notebookbox5 = dw_box_new( BOXVERT, 5 ); 1293 notebookbox5 = dw_box_new( BOXVERT, 5 );
1199 notebookpage5 = dw_notebook_page_new( notebook, 1, FALSE ); 1294 notebookpage5 = dw_notebook_page_new( notebook, 1, FALSE );
1200 dw_notebook_pack( notebook, notebookpage5, notebookbox5 ); 1295 dw_notebook_pack( notebook, notebookpage5, notebookbox5 );
1201 dw_notebook_page_set_text( notebook, notebookpage5, "buttons"); 1296 dw_notebook_page_set_text( notebook, notebookpage5, "buttons");
1202 buttons_add(); 1297 buttons_add();
1203 1298
1204 notebookbox6 = dw_box_new( BOXVERT, 5 ); 1299 notebookbox6 = dw_box_new( BOXVERT, 5 );
1205 notebookpage6 = dw_notebook_page_new( notebook, 1, FALSE ); 1300 notebookpage6 = dw_notebook_page_new( notebook, 1, FALSE );
1206 dw_notebook_pack( notebook, notebookpage6, notebookbox6 ); 1301 dw_notebook_pack( notebook, notebookpage6, notebookbox6 );
1207 dw_notebook_page_set_text( notebook, notebookpage6, "mdi"); 1302 dw_notebook_page_set_text( notebook, notebookpage6, "mdi");
1208 mdi_add(); 1303 mdi_add();
1209 1304
1210 notebookbox7 = dw_box_new( BOXVERT, 6 ); 1305 notebookbox7 = dw_box_new( BOXVERT, 6 );
1211 notebookpage7 = dw_notebook_page_new( notebook, 1, FALSE ); 1306 notebookpage7 = dw_notebook_page_new( notebook, 1, FALSE );
1212 dw_notebook_pack( notebook, notebookpage7, notebookbox7 ); 1307 dw_notebook_pack( notebook, notebookpage7, notebookbox7 );
1213 dw_notebook_page_set_text( notebook, notebookpage7, "html"); 1308 dw_notebook_page_set_text( notebook, notebookpage7, "html");
1214 1309
1215 #if 1 1310 #if 1
1216 rawhtml = dw_html_new(1001); 1311 rawhtml = dw_html_new(1001);
1217 dw_box_pack_start( notebookbox7, rawhtml, 0, 100, TRUE, FALSE, 0); 1312 dw_box_pack_start( notebookbox7, rawhtml, 0, 100, TRUE, FALSE, 0);
1218 dw_html_raw(rawhtml, "<html><body><center><h1>dwtest</h1></center></body></html>"); 1313 dw_html_raw(rawhtml, "<html><body><center><h1>dwtest</h1></center></body></html>");
1219 html = dw_html_new(1002); 1314 html = dw_html_new(1002);
1220 dw_box_pack_start( notebookbox7, html, 0, 100, TRUE, TRUE, 0); 1315 dw_box_pack_start( notebookbox7, html, 0, 100, TRUE, TRUE, 0);
1221 /* 1316 /*
1222 * This originally had: 1317 * This originally had:
1223 dw_html_url(html, "http://dwindows.netlabs.org"); 1318 dw_html_url(html, "http://dwindows.netlabs.org");
1224 * but as the base file is XML, the Windows browser instance can't display it. 1319 * but as the base file is XML, the Windows browser instance can't display it.
1225 * Instead a pure HTML based web page is displayed. MHES 5/4/2008 1320 * Instead a pure HTML based web page is displayed. MHES 5/4/2008
1226 */ 1321 */
1227 dw_html_url(html, "http://www.rexx.org"); 1322 dw_html_url(html, "http://www.rexx.org");
1228 #endif 1323 #endif
1229 1324
1230 notebookbox8 = dw_box_new( BOXVERT, 7 ); 1325 notebookbox8 = dw_box_new( BOXVERT, 7 );
1231 notebookpage8 = dw_notebook_page_new( notebook, 1, FALSE ); 1326 notebookpage8 = dw_notebook_page_new( notebook, 1, FALSE );
1232 dw_notebook_pack( notebook, notebookpage8, notebookbox8 ); 1327 dw_notebook_pack( notebook, notebookpage8, notebookbox8 );
1233 dw_notebook_page_set_text( notebook, notebookpage8, "scrollbox"); 1328 dw_notebook_page_set_text( notebook, notebookpage8, "scrollbox");
1234 scrollbox_add(); 1329 scrollbox_add();
1235 1330
1236 dw_signal_connect(mainwindow, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); 1331 dw_signal_connect(mainwindow, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow);
1237 timerid = dw_timer_connect(2000, DW_SIGNAL_FUNC(timer_callback), 0); 1332 timerid = dw_timer_connect(2000, DW_SIGNAL_FUNC(timer_callback), 0);
1238 dw_window_set_size(mainwindow, 640, 520); 1333 dw_window_set_size(mainwindow, 640, 520);
1239 dw_window_show(mainwindow); 1334 dw_window_show(mainwindow);
1240 1335 dw_window_capture(textbox2);
1241 dw_main(); 1336
1242 1337 dw_main();
1243 return 0; 1338
1244 } 1339 return 0;
1340 }