comparison dwtest.c @ 2410:0286ac44d347

Add DW_FEATURE_TREE feature test, since iOS does not suppor tree. Update dwtest to show a placeholder when missing the tree widget. Remove DW_FEATURE_CONTAINER_STRIPE from GTK4. Apparently it is supported with the GtkListBox widget and custom CSS, but it performs badly and is unrecommended by the GTK development team. Finally add missing feature test example code to the template source.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 30 Mar 2021 08:28:35 +0000
parents 716f38f69073
children 65ff339e9cd2
comparison
equal deleted inserted replaced
2409:2ab3e88e5d68 2410:0286ac44d347
151 int render_type = SHAPES_DOUBLE_BUFFERED; 151 int render_type = SHAPES_DOUBLE_BUFFERED;
152 152
153 FILE *fp=NULL; 153 FILE *fp=NULL;
154 char **lp; 154 char **lp;
155 155
156 char *resolve_keyname( int vk ) 156 char *resolve_keyname(int vk)
157 { 157 {
158 char *keyname; 158 char *keyname;
159 switch(vk) 159 switch(vk)
160 { 160 {
161 case VK_LBUTTON : keyname = "VK_LBUTTON"; break; 161 case VK_LBUTTON : keyname = "VK_LBUTTON"; break;
241 return keyname; 241 return keyname;
242 } 242 }
243 243
244 char *resolve_keymodifiers( int mask ) 244 char *resolve_keymodifiers( int mask )
245 { 245 {
246 if ( (mask & KC_CTRL) && (mask & KC_SHIFT) && (mask & KC_ALT) ) 246 if((mask & KC_CTRL) && (mask & KC_SHIFT) && (mask & KC_ALT))
247 return "KC_CTRL KC_SHIFT KC_ALT"; 247 return "KC_CTRL KC_SHIFT KC_ALT";
248 else if ( (mask & KC_CTRL) && (mask & KC_SHIFT) ) 248 else if((mask & KC_CTRL) && (mask & KC_SHIFT))
249 return "KC_CTRL KC_SHIFT"; 249 return "KC_CTRL KC_SHIFT";
250 else if ( (mask & KC_CTRL) && (mask & KC_ALT) ) 250 else if((mask & KC_CTRL) && (mask & KC_ALT))
251 return "KC_CTRL KC_ALT"; 251 return "KC_CTRL KC_ALT";
252 else if ( (mask & KC_SHIFT) && (mask & KC_ALT) ) 252 else if((mask & KC_SHIFT) && (mask & KC_ALT))
253 return "KC_SHIFT KC_ALT"; 253 return "KC_SHIFT KC_ALT";
254 else if ( (mask & KC_SHIFT) ) 254 else if((mask & KC_SHIFT))
255 return "KC_SHIFT"; 255 return "KC_SHIFT";
256 else if ( (mask & KC_CTRL) ) 256 else if((mask & KC_CTRL))
257 return "KC_CTRL"; 257 return "KC_CTRL";
258 else if ( (mask & KC_ALT) ) 258 else if((mask & KC_ALT))
259 return "KC_ALT"; 259 return "KC_ALT";
260 else return "none"; 260 else return "none";
261 } 261 }
262 262
263 void update_render(void); 263 void update_render(void);
268 if(render_type != SHAPES_DIRECT) 268 if(render_type != SHAPES_DIRECT)
269 { 269 {
270 HPIXMAP hpm; 270 HPIXMAP hpm;
271 unsigned long width,height; 271 unsigned long width,height;
272 272
273 if ( hwnd == textbox1 ) 273 if (hwnd == textbox1)
274 hpm = text1pm; 274 hpm = text1pm;
275 else if ( hwnd == textbox2 ) 275 else if(hwnd == textbox2)
276 hpm = text2pm; 276 hpm = text2pm;
277 else 277 else
278 return TRUE; 278 return TRUE;
279 279
280 width = (int)DW_PIXMAP_WIDTH(hpm); 280 width = (int)DW_PIXMAP_WIDTH(hpm);
291 } 291 }
292 292
293 void read_file( void ) 293 void read_file( void )
294 { 294 {
295 int i,len; 295 int i,len;
296 fp = fopen( current_file, "r" ); 296 fp = fopen(current_file, "r" );
297 if ( fp ) 297 if(fp)
298 { 298 {
299 lp = (char **)calloc( 1000,sizeof(char *)); 299 lp = (char **)calloc( 1000,sizeof(char *));
300 /* should test for out of memory */ 300 /* should test for out of memory */
301 max_linewidth=0; 301 max_linewidth=0;
302 for ( i = 0; i < 1000; i++ ) 302 for(i = 0; i < 1000; i++)
303 { 303 {
304 lp[i] = (char *)calloc(1, 1025); 304 lp[i] = (char *)calloc(1, 1025);
305 if ( fgets( lp[i], 1024, fp ) == NULL ) 305 if (fgets( lp[i], 1024, fp ) == NULL)
306 break; 306 break;
307 len = (int)strlen( lp[i] ); 307 len = (int)strlen( lp[i] );
308 if ( len > max_linewidth ) 308 if (len > max_linewidth)
309 max_linewidth = len; 309 max_linewidth = len;
310 if ( lp[i][len - 1] == '\n' ) 310 if(lp[i][len - 1] == '\n')
311 lp[i][len - 1] = '\0'; 311 lp[i][len - 1] = '\0';
312 } 312 }
313 num_lines = i; 313 num_lines = i;
314 fclose( fp ); 314 fclose(fp);
315 dw_scrollbar_set_range(hscrollbar, max_linewidth, cols); 315 dw_scrollbar_set_range(hscrollbar, max_linewidth, cols);
316 dw_scrollbar_set_pos(hscrollbar, 0); 316 dw_scrollbar_set_pos(hscrollbar, 0);
317 dw_scrollbar_set_range(vscrollbar, num_lines, rows); 317 dw_scrollbar_set_range(vscrollbar, num_lines, rows);
318 dw_scrollbar_set_pos(vscrollbar, 0); 318 dw_scrollbar_set_pos(vscrollbar, 0);
319 } 319 }
320 } 320 }
321 321
322 /* When hpma is not NULL we are printing.. so handle things differently */ 322 /* When hpma is not NULL we are printing.. so handle things differently */
323 void draw_file( int row, int col, int nrows, int fheight, HPIXMAP hpma ) 323 void draw_file(int row, int col, int nrows, int fheight, HPIXMAP hpma)
324 { 324 {
325 HPIXMAP hpm = hpma ? hpma : text2pm; 325 HPIXMAP hpm = hpma ? hpma : text2pm;
326 char buf[10]; 326 char buf[10];
327 int i,y,fileline; 327 int i,y,fileline;
328 char *pLine; 328 char *pLine;
329 329
330 if ( current_file ) 330 if(current_file)
331 { 331 {
332 dw_color_foreground_set(DW_CLR_WHITE); 332 dw_color_foreground_set(DW_CLR_WHITE);
333 if(!hpma) 333 if(!hpma)
334 dw_draw_rect(0, text1pm, DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, (int)DW_PIXMAP_WIDTH(text1pm), (int)DW_PIXMAP_HEIGHT(text1pm)); 334 dw_draw_rect(0, text1pm, DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, (int)DW_PIXMAP_WIDTH(text1pm), (int)DW_PIXMAP_HEIGHT(text1pm));
335 dw_draw_rect(0, hpm, DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, (int)DW_PIXMAP_WIDTH(hpm), (int)DW_PIXMAP_HEIGHT(hpm)); 335 dw_draw_rect(0, hpm, DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, (int)DW_PIXMAP_WIDTH(hpm), (int)DW_PIXMAP_HEIGHT(hpm));
336 336
337 for ( i = 0;(i < nrows) && (i+row < num_lines); i++) 337 for(i = 0;(i < nrows) && (i+row < num_lines); i++)
338 { 338 {
339 fileline = i + row - 1; 339 fileline = i + row - 1;
340 y = i*fheight; 340 y = i*fheight;
341 dw_color_background_set( 1 + (fileline % 15) ); 341 dw_color_background_set(1 + (fileline % 15) );
342 dw_color_foreground_set( fileline < 0 ? DW_CLR_WHITE : fileline % 16 ); 342 dw_color_foreground_set(fileline < 0 ? DW_CLR_WHITE : fileline % 16);
343 if(!hpma) 343 if(!hpma)
344 { 344 {
345 sprintf( buf, "%6.6d", i+row ); 345 sprintf( buf, "%6.6d", i+row );
346 dw_draw_text( 0, text1pm, 0, y, buf); 346 dw_draw_text( 0, text1pm, 0, y, buf);
347 } 347 }
348 pLine = lp[i+row]; 348 pLine = lp[i+row];
349 dw_draw_text( 0, hpm, 0, y, pLine+col ); 349 dw_draw_text(0, hpm, 0, y, pLine+col);
350 } 350 }
351 } 351 }
352 } 352 }
353 353
354 /* When hpma is not NULL we are printing.. so handle things differently */ 354 /* When hpma is not NULL we are printing.. so handle things differently */
531 return FALSE; 531 return FALSE;
532 } 532 }
533 533
534 int DWSIGNAL beep_callback(HWND window, void *data) 534 int DWSIGNAL beep_callback(HWND window, void *data)
535 { 535 {
536 dw_timer_disconnect( timerid ); 536 dw_timer_disconnect(timerid);
537 return TRUE; 537 return TRUE;
538 } 538 }
539 539
540 int DWSIGNAL keypress_callback(HWND window, char ch, int vk, int state, void *data, char *utf8) 540 int DWSIGNAL keypress_callback(HWND window, char ch, int vk, int state, void *data, char *utf8)
541 { 541 {
542 char tmpbuf[100]; 542 char tmpbuf[100];
543 if ( ch ) 543 if ( ch )
544 sprintf( tmpbuf, "Key: %c(%d) Modifiers: %s(%d) utf8 %s", ch, ch, resolve_keymodifiers(state), state, utf8 ); 544 sprintf(tmpbuf, "Key: %c(%d) Modifiers: %s(%d) utf8 %s", ch, ch, resolve_keymodifiers(state), state, utf8);
545 else 545 else
546 sprintf( tmpbuf, "Key: %s(%d) Modifiers: %s(%d) utf8 %s", resolve_keyname(vk), vk, resolve_keymodifiers(state), state, utf8 ); 546 sprintf(tmpbuf, "Key: %s(%d) Modifiers: %s(%d) utf8 %s", resolve_keyname(vk), vk, resolve_keymodifiers(state), state, utf8);
547 dw_window_set_text( status1, tmpbuf); 547 dw_window_set_text(status1, tmpbuf);
548 return 0; 548 return 0;
549 } 549 }
550 550
551 int DWSIGNAL menu_callback(HWND window, void *data) 551 int DWSIGNAL menu_callback(HWND window, void *data)
552 { 552 {
553 char buf[100]; 553 char buf[100];
554 554
555 sprintf( buf, "%s menu item selected", (char *)data ); 555 sprintf(buf, "%s menu item selected", (char *)data);
556 dw_messagebox( "Menu Item Callback", DW_MB_OK | DW_MB_INFORMATION, buf ); 556 dw_messagebox("Menu Item Callback", DW_MB_OK | DW_MB_INFORMATION, buf);
557 return 0; 557 return 0;
558 } 558 }
559 559
560 int DWSIGNAL menutoggle_callback(HWND window, void *data) 560 int DWSIGNAL menutoggle_callback(HWND window, void *data)
561 { 561 {
562 if ( menu_enabled ) 562 if (menu_enabled)
563 { 563 {
564 dw_menu_item_set_state( changeable_menu, CHECKABLE_MENUITEMID, DW_MIS_DISABLED ); 564 dw_menu_item_set_state(changeable_menu, CHECKABLE_MENUITEMID, DW_MIS_DISABLED);
565 dw_menu_item_set_state( changeable_menu, NONCHECKABLE_MENUITEMID, DW_MIS_DISABLED ); 565 dw_menu_item_set_state(changeable_menu, NONCHECKABLE_MENUITEMID, DW_MIS_DISABLED);
566 menu_enabled = 0; 566 menu_enabled = 0;
567 } 567 }
568 else 568 else
569 { 569 {
570 dw_menu_item_set_state( changeable_menu, CHECKABLE_MENUITEMID, DW_MIS_ENABLED ); 570 dw_menu_item_set_state(changeable_menu, CHECKABLE_MENUITEMID, DW_MIS_ENABLED);
571 dw_menu_item_set_state( changeable_menu, NONCHECKABLE_MENUITEMID, DW_MIS_ENABLED ); 571 dw_menu_item_set_state(changeable_menu, NONCHECKABLE_MENUITEMID, DW_MIS_ENABLED);
572 menu_enabled = 1; 572 menu_enabled = 1;
573 } 573 }
574 return 0; 574 return 0;
575 } 575 }
576 576
577 int DWSIGNAL helpabout_callback(HWND window, void *data) 577 int DWSIGNAL helpabout_callback(HWND window, void *data)
578 { 578 {
579 DWEnv env; 579 DWEnv env;
580 580
581 dw_environment_query(&env); 581 dw_environment_query(&env);
582 dw_messagebox( "About dwindows", DW_MB_OK | DW_MB_INFORMATION, "dwindows test\n\nOS: %s %s %s Version: %d.%d.%d.%d HTML: %s\n\ndwindows Version: %d.%d.%d", 582 dw_messagebox("About dwindows", DW_MB_OK | DW_MB_INFORMATION, "dwindows test\n\nOS: %s %s %s Version: %d.%d.%d.%d HTML: %s\n\ndwindows Version: %d.%d.%d",
583 env.osName, env.buildDate, env.buildTime, 583 env.osName, env.buildDate, env.buildTime,
584 env.MajorVersion, env.MinorVersion, env.MajorBuild, env.MinorBuild, 584 env.MajorVersion, env.MinorVersion, env.MajorBuild, env.MinorBuild,
585 env.htmlEngine, 585 env.htmlEngine,
586 env.DWMajorVersion, env.DWMinorVersion, env.DWSubVersion ); 586 env.DWMajorVersion, env.DWMinorVersion, env.DWSubVersion);
587 return 0; 587 return 0;
588 } 588 }
589 589
590 int DWSIGNAL exit_callback(HWND window, void *data) 590 int DWSIGNAL exit_callback(HWND window, void *data)
591 { 591 {
603 } 603 }
604 604
605 int DWSIGNAL browse_file_callback(HWND window, void *data) 605 int DWSIGNAL browse_file_callback(HWND window, void *data)
606 { 606 {
607 char *tmp; 607 char *tmp;
608 tmp = dw_file_browse("Pick a file", "dwtest.c", "c", DW_FILE_OPEN ); 608 tmp = dw_file_browse("Pick a file", "dwtest.c", "c", DW_FILE_OPEN);
609 if ( tmp ) 609 if ( tmp )
610 { 610 {
611 HWND notification = dw_notification_new("New file loaded", "image/test.png", "dwtest loaded \"%s\" into the file browser on the Render tab, with \"File Display\" selected from the drop down list.", tmp); 611 HWND notification = dw_notification_new("New file loaded", "image/test.png", "dwtest loaded \"%s\" into the file browser on the Render tab, with \"File Display\" selected from the drop down list.", tmp);
612 612
613 if ( current_file ) 613 if (current_file)
614 { 614 {
615 dw_free( current_file ); 615 dw_free( current_file );
616 } 616 }
617 current_file = tmp; 617 current_file = tmp;
618 dw_window_set_text( entryfield, current_file ); 618 dw_window_set_text(entryfield, current_file);
619 read_file(); 619 read_file();
620 current_col = current_row = 0; 620 current_col = current_row = 0;
621 render_draw(); 621 render_draw();
622 dw_signal_connect(notification, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(notification_clicked_callback), NULL); 622 dw_signal_connect(notification, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(notification_clicked_callback), NULL);
623 dw_notification_send(notification); 623 dw_notification_send(notification);
647 dw_listbox_get_text( combobox1, idx, buf1, 99 ); 647 dw_listbox_get_text( combobox1, idx, buf1, 99 );
648 idx = dw_listbox_selected( combobox2 ); 648 idx = dw_listbox_selected( combobox2 );
649 dw_listbox_get_text( combobox2, idx, buf2, 99 ); 649 dw_listbox_get_text( combobox2, idx, buf2, 99 );
650 dw_calendar_get_date( cal, &y, &m, &d ); 650 dw_calendar_get_date( cal, &y, &m, &d );
651 spvalue = dw_spinbutton_get_pos( spinbutton ); 651 spvalue = dw_spinbutton_get_pos( spinbutton );
652 len = sprintf( buf3, "spinbutton: %ld\ncombobox1: \"%s\"\ncombobox2: \"%s\"\ncalendar: %d-%d-%d", 652 len = sprintf(buf3, "spinbutton: %ld\ncombobox1: \"%s\"\ncombobox2: \"%s\"\ncalendar: %d-%d-%d",
653 spvalue, 653 spvalue,
654 buf1, buf2, 654 buf1, buf2,
655 y, m, d ); 655 y, m, d);
656 dw_messagebox( "Values", DW_MB_OK | DW_MB_INFORMATION, buf3 ); 656 dw_messagebox("Values", DW_MB_OK | DW_MB_INFORMATION, buf3 );
657 dw_clipboard_set_text( buf3, len ); 657 dw_clipboard_set_text(buf3, len );
658 return 0; 658 return 0;
659 } 659 }
660 660
661 int DWSIGNAL bitmap_toggle_callback(HWND window, void *data) 661 int DWSIGNAL bitmap_toggle_callback(HWND window, void *data)
662 { 662 {
663 static int isfoldericon = 1; 663 static int isfoldericon = 1;
664 664
665 if ( isfoldericon ) 665 if ( isfoldericon )
666 { 666 {
667 isfoldericon = 0; 667 isfoldericon = 0;
668 dw_window_set_bitmap( window, 0, FILE_ICON_NAME ); 668 dw_window_set_bitmap(window, 0, FILE_ICON_NAME );
669 dw_window_set_tooltip( window, "File Icon" ); 669 dw_window_set_tooltip(window, "File Icon" );
670 } 670 }
671 else 671 else
672 { 672 {
673 isfoldericon = 1; 673 isfoldericon = 1;
674 dw_window_set_bitmap_from_data( window, 0, folder_ico, sizeof(folder_ico) ); 674 dw_window_set_bitmap_from_data( window, 0, folder_ico, sizeof(folder_ico) );
675 dw_window_set_tooltip( window, "Folder Icon" ); 675 dw_window_set_tooltip(window, "Folder Icon" );
676 } 676 }
677 return 0; 677 return 0;
678 } 678 }
679 679
680 int DWSIGNAL percent_button_box_callback(HWND window, void *data) 680 int DWSIGNAL percent_button_box_callback(HWND window, void *data)
1053 /* create a box to pack into the notebook page */ 1053 /* create a box to pack into the notebook page */
1054 pagebox = dw_box_new(DW_HORZ, 2); 1054 pagebox = dw_box_new(DW_HORZ, 2);
1055 dw_box_pack_start( notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0); 1055 dw_box_pack_start( notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0);
1056 /* now a status area under this box */ 1056 /* now a status area under this box */
1057 hbox = dw_box_new(DW_HORZ, 1 ); 1057 hbox = dw_box_new(DW_HORZ, 1 );
1058 dw_box_pack_start( notebookbox2, hbox, 100, 20, TRUE, FALSE, 1); 1058 dw_box_pack_start(notebookbox2, hbox, 100, 20, TRUE, FALSE, 1);
1059 status1 = dw_status_text_new("", 0); 1059 status1 = dw_status_text_new("", 0);
1060 dw_box_pack_start( hbox, status1, 100, -1, TRUE, FALSE, 1); 1060 dw_box_pack_start(hbox, status1, 100, -1, TRUE, FALSE, 1);
1061 status2 = dw_status_text_new("", 0); 1061 status2 = dw_status_text_new("", 0);
1062 dw_box_pack_start( hbox, status2, 100, -1, TRUE, FALSE, 1); 1062 dw_box_pack_start(hbox, status2, 100, -1, TRUE, FALSE, 1);
1063 /* a box with combobox and button */ 1063 /* a box with combobox and button */
1064 hbox = dw_box_new(DW_HORZ, 1 ); 1064 hbox = dw_box_new(DW_HORZ, 1 );
1065 dw_box_pack_start( notebookbox2, hbox, 100, 25, TRUE, FALSE, 1); 1065 dw_box_pack_start(notebookbox2, hbox, 100, 25, TRUE, FALSE, 1);
1066 rendcombo = dw_combobox_new( "Shapes Double Buffered", 0 ); 1066 rendcombo = dw_combobox_new( "Shapes Double Buffered", 0 );
1067 dw_box_pack_start( hbox, rendcombo, 80, 25, TRUE, TRUE, 0); 1067 dw_box_pack_start(hbox, rendcombo, 80, 25, TRUE, TRUE, 0);
1068 dw_listbox_append(rendcombo, "Shapes Double Buffered"); 1068 dw_listbox_append(rendcombo, "Shapes Double Buffered");
1069 dw_listbox_append(rendcombo, "Shapes Direct"); 1069 dw_listbox_append(rendcombo, "Shapes Direct");
1070 dw_listbox_append(rendcombo, "File Display"); 1070 dw_listbox_append(rendcombo, "File Display");
1071 label = dw_text_new("Image X:", 100); 1071 label = dw_text_new("Image X:", 100);
1072 dw_window_set_style(label, DW_DT_VCENTER | DW_DT_CENTER, DW_DT_VCENTER | DW_DT_CENTER); 1072 dw_window_set_style(label, DW_DT_VCENTER | DW_DT_CENTER, DW_DT_VCENTER | DW_DT_CENTER);
1083 dw_spinbutton_set_pos(imagexspin, 20); 1083 dw_spinbutton_set_pos(imagexspin, 20);
1084 dw_spinbutton_set_pos(imageyspin, 20); 1084 dw_spinbutton_set_pos(imageyspin, 20);
1085 imagestretchcheck = dw_checkbox_new("Stretch", 1021); 1085 imagestretchcheck = dw_checkbox_new("Stretch", 1021);
1086 dw_box_pack_start( hbox, imagestretchcheck, -1, 25, FALSE, TRUE, 0); 1086 dw_box_pack_start( hbox, imagestretchcheck, -1, 25, FALSE, TRUE, 0);
1087 1087
1088 button1 = dw_button_new( "Refresh", 1223L ); 1088 button1 = dw_button_new("Refresh", 1223L );
1089 dw_box_pack_start( hbox, button1, 100, 25, FALSE, TRUE, 0); 1089 dw_box_pack_start( hbox, button1, 100, 25, FALSE, TRUE, 0);
1090 button2 = dw_button_new( "Print", 1224L ); 1090 button2 = dw_button_new("Print", 1224L );
1091 dw_box_pack_start( hbox, button2, 100, 25, FALSE, TRUE, 0); 1091 dw_box_pack_start( hbox, button2, 100, 25, FALSE, TRUE, 0);
1092 1092
1093 /* Pre-create the scrollbars so we can query their sizes */ 1093 /* Pre-create the scrollbars so we can query their sizes */
1094 vscrollbar = dw_scrollbar_new(DW_VERT, 50); 1094 vscrollbar = dw_scrollbar_new(DW_VERT, 50);
1095 hscrollbar = dw_scrollbar_new(DW_HORZ, 50); 1095 hscrollbar = dw_scrollbar_new(DW_HORZ, 50);
1116 1116
1117 /* pack empty space 1 character wide */ 1117 /* pack empty space 1 character wide */
1118 dw_box_pack_start(pagebox, 0, font_width, 0, FALSE, TRUE, 0); 1118 dw_box_pack_start(pagebox, 0, font_width, 0, FALSE, TRUE, 0);
1119 1119
1120 /* create box for filecontents and horz scrollbar */ 1120 /* create box for filecontents and horz scrollbar */
1121 textboxA = dw_box_new( DW_VERT,0 ); 1121 textboxA = dw_box_new(DW_VERT,0 );
1122 dw_box_pack_start( pagebox, textboxA, 0, 0, TRUE, TRUE, 0); 1122 dw_box_pack_start(pagebox, textboxA, 0, 0, TRUE, TRUE, 0);
1123 1123
1124 /* create render box for filecontents pixmap */ 1124 /* create render box for filecontents pixmap */
1125 textbox2 = dw_render_new( 101 ); 1125 textbox2 = dw_render_new( 101 );
1126 dw_box_pack_start( textboxA, textbox2, 10, 10, TRUE, TRUE, 0); 1126 dw_box_pack_start(textboxA, textbox2, 10, 10, TRUE, TRUE, 0);
1127 dw_window_set_font(textbox2, FIXEDFONT); 1127 dw_window_set_font(textbox2, FIXEDFONT);
1128 /* create horizonal scrollbar */ 1128 /* create horizonal scrollbar */
1129 dw_box_pack_start( textboxA, hscrollbar, -1, -1, TRUE, FALSE, 0); 1129 dw_box_pack_start(textboxA, hscrollbar, -1, -1, TRUE, FALSE, 0);
1130 1130
1131 /* create vertical scrollbar */ 1131 /* create vertical scrollbar */
1132 vscrollbox = dw_box_new(DW_VERT, 0); 1132 vscrollbox = dw_box_new(DW_VERT, 0);
1133 dw_box_pack_start(vscrollbox, vscrollbar, -1, -1, FALSE, TRUE, 0); 1133 dw_box_pack_start(vscrollbox, vscrollbar, -1, -1, FALSE, TRUE, 0);
1134 /* Pack an area of empty space 14x14 pixels */ 1134 /* Pack an area of empty space 14x14 pixels */
1135 dw_box_pack_start(vscrollbox, 0, vscrollbarwidth, hscrollbarheight, FALSE, FALSE, 0); 1135 dw_box_pack_start(vscrollbox, 0, vscrollbarwidth, hscrollbarheight, FALSE, FALSE, 0);
1136 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0); 1136 dw_box_pack_start(pagebox, vscrollbox, 0, 0, FALSE, TRUE, 0);
1137 1137
1138 text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, (int)depth ); 1138 text1pm = dw_pixmap_new(textbox1, font_width*width1, font_height*rows, (int)depth);
1139 text2pm = dw_pixmap_new( textbox2, font_width*cols, font_height*rows, (int)depth ); 1139 text2pm = dw_pixmap_new(textbox2, font_width*cols, font_height*rows, (int)depth);
1140 image = dw_pixmap_new_from_file(textbox2, "image/test"); 1140 image = dw_pixmap_new_from_file(textbox2, "image/test");
1141 if(!image) 1141 if(!image)
1142 image = dw_pixmap_new_from_file(textbox2, "~/test"); 1142 image = dw_pixmap_new_from_file(textbox2, "~/test");
1143 if(image) 1143 if(image)
1144 dw_pixmap_set_transparent_color(image, DW_CLR_WHITE); 1144 dw_pixmap_set_transparent_color(image, DW_CLR_WHITE);
1169 HWND listbox; 1169 HWND listbox;
1170 char *title; 1170 char *title;
1171 1171
1172 /* create a box to pack into the notebook page */ 1172 /* create a box to pack into the notebook page */
1173 listbox = dw_listbox_new(1024, TRUE); 1173 listbox = dw_listbox_new(1024, TRUE);
1174 dw_box_pack_start( notebookbox3, listbox, 500, 200, TRUE, TRUE, 0); 1174 dw_box_pack_start(notebookbox3, listbox, 500, 200, TRUE, TRUE, 0);
1175 dw_listbox_append(listbox, "Test 1"); 1175 dw_listbox_append(listbox, "Test 1");
1176 dw_listbox_append(listbox, "Test 2"); 1176 dw_listbox_append(listbox, "Test 2");
1177 dw_listbox_append(listbox, "Test 3"); 1177 dw_listbox_append(listbox, "Test 3");
1178 dw_listbox_append(listbox, "Test 4"); 1178 dw_listbox_append(listbox, "Test 4");
1179 dw_listbox_append(listbox, "Test 5"); 1179 dw_listbox_append(listbox, "Test 5");
1180 1180
1181 /* now a tree area under this box */ 1181 /* now a tree area under this box */
1182 tree = dw_tree_new(101); 1182 tree = dw_tree_new(101);
1183 dw_box_pack_start( notebookbox3, tree, 500, 200, TRUE, TRUE, 1); 1183 if(tree)
1184 1184 {
1185 /* and a status area to see whats going on */ 1185 dw_box_pack_start(notebookbox3, tree, 500, 200, TRUE, TRUE, 1);
1186 tree_status = dw_status_text_new("", 0); 1186
1187 dw_box_pack_start( notebookbox3, tree_status, 100, -1, TRUE, FALSE, 1); 1187 /* and a status area to see whats going on */
1188 1188 tree_status = dw_status_text_new("", 0);
1189 /* set up our signal trappers... */ 1189 dw_box_pack_start(notebookbox3, tree_status, 100, -1, TRUE, FALSE, 1);
1190 dw_signal_connect(tree, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), DW_POINTER(tree_status)); 1190
1191 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(item_select_cb), DW_POINTER(tree_status)); 1191 /* set up our signal trappers... */
1192 1192 dw_signal_connect(tree, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), DW_POINTER(tree_status));
1193 t1 = dw_tree_insert(tree, "tree folder 1", foldericon, NULL, DW_INT_TO_POINTER(1) ); 1193 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(item_select_cb), DW_POINTER(tree_status));
1194 t2 = dw_tree_insert(tree, "tree folder 2", foldericon, NULL, DW_INT_TO_POINTER(2) ); 1194
1195 dw_tree_insert(tree, "tree file 1", fileicon, t1, DW_INT_TO_POINTER(3) ); 1195 t1 = dw_tree_insert(tree, "tree folder 1", foldericon, NULL, DW_INT_TO_POINTER(1));
1196 dw_tree_insert(tree, "tree file 2", fileicon, t1, DW_INT_TO_POINTER(4) ); 1196 t2 = dw_tree_insert(tree, "tree folder 2", foldericon, NULL, DW_INT_TO_POINTER(2));
1197 dw_tree_insert(tree, "tree file 3", fileicon, t2, DW_INT_TO_POINTER(5) ); 1197 dw_tree_insert(tree, "tree file 1", fileicon, t1, DW_INT_TO_POINTER(3));
1198 dw_tree_insert(tree, "tree file 4", fileicon, t2, DW_INT_TO_POINTER(6) ); 1198 dw_tree_insert(tree, "tree file 2", fileicon, t1, DW_INT_TO_POINTER(4));
1199 dw_tree_item_change(tree, t1, "tree folder 1", foldericon ); 1199 dw_tree_insert(tree, "tree file 3", fileicon, t2, DW_INT_TO_POINTER(5));
1200 dw_tree_item_change(tree, t2, "tree folder 2", foldericon ); 1200 dw_tree_insert(tree, "tree file 4", fileicon, t2, DW_INT_TO_POINTER(6));
1201 dw_tree_item_set_data(tree, t2, DW_INT_TO_POINTER(100)); 1201 dw_tree_item_change(tree, t1, "tree folder 1", foldericon);
1202 title = dw_tree_get_title(tree, t1); 1202 dw_tree_item_change(tree, t2, "tree folder 2", foldericon);
1203 dw_debug("t1 title \"%s\" data %d t2 data %d\n", title, DW_POINTER_TO_INT(dw_tree_item_get_data(tree, t1)), DW_POINTER_TO_INT(dw_tree_item_get_data(tree, t2))); 1203 dw_tree_item_set_data(tree, t2, DW_INT_TO_POINTER(100));
1204 dw_free(title); 1204 title = dw_tree_get_title(tree, t1);
1205 dw_debug("t1 title \"%s\" data %d t2 data %d\n", title, DW_POINTER_TO_INT(dw_tree_item_get_data(tree, t1)), DW_POINTER_TO_INT(dw_tree_item_get_data(tree, t2)));
1206 dw_free(title);
1207 }
1208 else
1209 {
1210 tree = dw_text_new("Tree widget not available.", 0);
1211 dw_box_pack_start(notebookbox3, tree, 500, 200, TRUE, TRUE, 1);
1212 }
1205 } 1213 }
1206 1214
1207 int DWSIGNAL word_wrap_click_cb(HWND wordwrap, void *data) 1215 int DWSIGNAL word_wrap_click_cb(HWND wordwrap, void *data)
1208 { 1216 {
1209 HWND container_mle = (HWND)data; 1217 HWND container_mle = (HWND)data;
1525 int i; 1533 int i;
1526 char **text; 1534 char **text;
1527 1535
1528 /* create a box to pack into the notebook page */ 1536 /* create a box to pack into the notebook page */
1529 buttonsbox = dw_box_new(DW_VERT, 2); 1537 buttonsbox = dw_box_new(DW_VERT, 2);
1530 dw_box_pack_start( notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0); 1538 dw_box_pack_start(notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0);
1531 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED); 1539 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED);
1532 1540
1533 calbox = dw_box_new(DW_HORZ, 0); 1541 calbox = dw_box_new(DW_HORZ, 0);
1534 dw_box_pack_start(notebookbox5, calbox, 500, 200, TRUE, TRUE, 1); 1542 dw_box_pack_start(notebookbox5, calbox, 500, 200, TRUE, TRUE, 1);
1535 cal = dw_calendar_new(100); 1543 cal = dw_calendar_new(100);
1538 dw_calendar_set_date(cal, 2019, 4, 30); 1546 dw_calendar_set_date(cal, 2019, 4, 30);
1539 1547
1540 /* 1548 /*
1541 * Create our file toolbar boxes... 1549 * Create our file toolbar boxes...
1542 */ 1550 */
1543 buttonboxperm = dw_box_new( DW_VERT, 0 ); 1551 buttonboxperm = dw_box_new(DW_VERT, 0);
1544 dw_box_pack_start( buttonsbox, buttonboxperm, 25, 0, FALSE, TRUE, 2 ); 1552 dw_box_pack_start(buttonsbox, buttonboxperm, 25, 0, FALSE, TRUE, 2);
1545 dw_window_set_color(buttonboxperm, DW_CLR_WHITE, DW_CLR_WHITE); 1553 dw_window_set_color(buttonboxperm, DW_CLR_WHITE, DW_CLR_WHITE);
1546 abutton1 = dw_bitmapbutton_new_from_file( "Top Button", 0, FILE_ICON_NAME ); 1554 abutton1 = dw_bitmapbutton_new_from_file("Top Button", 0, FILE_ICON_NAME);
1547 dw_box_pack_start( buttonboxperm, abutton1, 100, 30, FALSE, FALSE, 0 ); 1555 dw_box_pack_start(buttonboxperm, abutton1, 100, 30, FALSE, FALSE, 0 );
1548 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); 1556 dw_signal_connect(abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL);
1549 dw_box_pack_start( buttonboxperm, 0, 25, 5, FALSE, FALSE, 0 ); 1557 dw_box_pack_start(buttonboxperm, 0, 25, 5, FALSE, FALSE, 0);
1550 abutton2 = dw_bitmapbutton_new_from_data( "Folder Icon", 0, folder_ico, sizeof( folder_ico) ); 1558 abutton2 = dw_bitmapbutton_new_from_data( "Folder Icon", 0, folder_ico, sizeof(folder_ico));
1551 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 ); 1559 dw_box_pack_start(buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0);
1552 dw_signal_connect( abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(bitmap_toggle_callback), NULL ); 1560 dw_signal_connect(abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(bitmap_toggle_callback), NULL);
1553 1561
1554 create_button(0); 1562 create_button(0);
1555 /* make a combobox */ 1563 /* make a combobox */
1556 combox = dw_box_new(DW_VERT, 2); 1564 combox = dw_box_new(DW_VERT, 2);
1557 dw_box_pack_start( notebookbox5, combox, 25, 200, TRUE, FALSE, 0); 1565 dw_box_pack_start(notebookbox5, combox, 25, 200, TRUE, FALSE, 0);
1558 combobox1 = dw_combobox_new( "fred", 0 ); /* no point in specifying an initial value */ 1566 combobox1 = dw_combobox_new("fred", 0); /* no point in specifying an initial value */
1559 dw_listbox_append( combobox1, "fred" ); 1567 dw_listbox_append(combobox1, "fred");
1560 dw_box_pack_start( combox, combobox1, -1, -1, TRUE, FALSE, 0); 1568 dw_box_pack_start(combox, combobox1, -1, -1, TRUE, FALSE, 0);
1561 /* 1569 /*
1562 dw_window_set_text( combobox, "initial value"); 1570 dw_window_set_text( combobox, "initial value");
1563 */ 1571 */
1564 dw_signal_connect( combobox1, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL ); 1572 dw_signal_connect(combobox1, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL);
1565 #if 0 1573 #if 0
1566 /* add LOTS of items */ 1574 /* add LOTS of items */
1567 dw_debug("before appending 100 items to combobox using dw_listbox_append()\n"); 1575 dw_debug("before appending 100 items to combobox using dw_listbox_append()\n");
1568 for( i = 0; i < 100; i++ ) 1576 for(i = 0; i < 100; i++)
1569 { 1577 {
1570 sprintf( buf, "item %d", i); 1578 sprintf( buf, "item %d", i);
1571 dw_listbox_append( combobox1, buf ); 1579 dw_listbox_append(combobox1, buf);
1572 } 1580 }
1573 dw_debug("after appending 100 items to combobox\n"); 1581 dw_debug("after appending 100 items to combobox\n");
1574 #endif 1582 #endif
1575 1583
1576 combobox2 = dw_combobox_new( "joe", 0 ); /* no point in specifying an initial value */ 1584 combobox2 = dw_combobox_new("joe", 0); /* no point in specifying an initial value */
1577 dw_box_pack_start( combox, combobox2, -1, -1, TRUE, FALSE, 0); 1585 dw_box_pack_start(combox, combobox2, -1, -1, TRUE, FALSE, 0);
1578 /* 1586 /*
1579 dw_window_set_text( combobox, "initial value"); 1587 dw_window_set_text(combobox, "initial value");
1580 */ 1588 */
1581 dw_signal_connect( combobox2, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL ); 1589 dw_signal_connect(combobox2, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL);
1582 /* add LOTS of items */ 1590 /* add LOTS of items */
1583 dw_debug("before appending 500 items to combobox using dw_listbox_list_append()\n"); 1591 dw_debug("before appending 500 items to combobox using dw_listbox_list_append()\n");
1584 text = (char **)malloc(500*sizeof(char *)); 1592 text = (char **)malloc(500*sizeof(char *));
1585 for( i = 0; i < 500; i++ ) 1593 for(i = 0; i < 500; i++)
1586 { 1594 {
1587 text[i] = (char *)malloc( 50 ); 1595 text[i] = (char *)malloc(50);
1588 sprintf( text[i], "item %d", i); 1596 sprintf( text[i], "item %d", i);
1589 } 1597 }
1590 dw_listbox_list_append( combobox2, text, 500 ); 1598 dw_listbox_list_append(combobox2, text, 500);
1591 dw_debug("after appending 500 items to combobox\n"); 1599 dw_debug("after appending 500 items to combobox\n");
1592 for( i = 0; i < 500; i++ ) 1600 for(i = 0; i < 500; i++)
1593 { 1601 {
1594 free(text[i]); 1602 free(text[i]);
1595 } 1603 }
1596 free(text); 1604 free(text);
1597 /* now insert a couple of items */ 1605 /* now insert a couple of items */
1598 dw_listbox_insert( combobox2, "inserted item 2", 2 ); 1606 dw_listbox_insert(combobox2, "inserted item 2", 2);
1599 dw_listbox_insert( combobox2, "inserted item 5", 5 ); 1607 dw_listbox_insert(combobox2, "inserted item 5", 5);
1600 /* make a spinbutton */ 1608 /* make a spinbutton */
1601 spinbutton = dw_spinbutton_new( "", 0 ); /* no point in specifying text */ 1609 spinbutton = dw_spinbutton_new("", 0); /* no point in specifying text */
1602 dw_box_pack_start( combox, spinbutton, -1, -1, TRUE, FALSE, 0); 1610 dw_box_pack_start(combox, spinbutton, -1, -1, TRUE, FALSE, 0);
1603 dw_spinbutton_set_limits( spinbutton, 100, 1 ); 1611 dw_spinbutton_set_limits(spinbutton, 100, 1);
1604 dw_spinbutton_set_pos( spinbutton, 30 ); 1612 dw_spinbutton_set_pos(spinbutton, 30);
1605 dw_signal_connect( spinbutton, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(spinbutton_valuechanged_callback), NULL ); 1613 dw_signal_connect(spinbutton, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(spinbutton_valuechanged_callback), NULL);
1606 /* make a slider */ 1614 /* make a slider */
1607 slider = dw_slider_new( FALSE, 11, 0 ); /* no point in specifying text */ 1615 slider = dw_slider_new(FALSE, 11, 0); /* no point in specifying text */
1608 dw_box_pack_start( combox, slider, -1, -1, TRUE, FALSE, 0); 1616 dw_box_pack_start(combox, slider, -1, -1, TRUE, FALSE, 0);
1609 dw_signal_connect( slider, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(slider_valuechanged_callback), NULL ); 1617 dw_signal_connect(slider, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(slider_valuechanged_callback), NULL);
1610 /* make a percent */ 1618 /* make a percent */
1611 percent = dw_percent_new( 0 ); 1619 percent = dw_percent_new(0);
1612 dw_box_pack_start( combox, percent, -1, -1, TRUE, FALSE, 0); 1620 dw_box_pack_start(combox, percent, -1, -1, TRUE, FALSE, 0);
1613 } 1621 }
1614 1622
1615 void create_button( int redraw) 1623 void create_button( int redraw)
1616 { 1624 {
1617 HWND abutton1; 1625 HWND abutton1;
1618 filetoolbarbox = dw_box_new( DW_VERT, 0 ); 1626 filetoolbarbox = dw_box_new(DW_VERT, 0);
1619 dw_box_pack_start( buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0 ); 1627 dw_box_pack_start(buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0);
1620 1628
1621 abutton1 = dw_bitmapbutton_new_from_file( "Empty image. Should be under Top button", 0, "junk" ); 1629 abutton1 = dw_bitmapbutton_new_from_file("Empty image. Should be under Top button", 0, "junk");
1622 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1630 dw_box_pack_start(filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
1623 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_red_callback), NULL ); 1631 dw_signal_connect(abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_red_callback), NULL);
1624 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); 1632 dw_box_pack_start(filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 );
1625 1633
1626 abutton1 = dw_bitmapbutton_new_from_data( "A borderless bitmapbitton", 0, folder_ico, 1718 ); 1634 abutton1 = dw_bitmapbutton_new_from_data("A borderless bitmapbitton", 0, folder_ico, 1718 );
1627 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1635 dw_box_pack_start(filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
1628 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_yellow_callback), NULL ); 1636 dw_signal_connect(abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_yellow_callback), NULL);
1629 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); 1637 dw_box_pack_start(filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0);
1630 dw_window_set_style( abutton1, DW_BS_NOBORDER, DW_BS_NOBORDER ); 1638 dw_window_set_style(abutton1, DW_BS_NOBORDER, DW_BS_NOBORDER);
1631 1639
1632 abutton1 = dw_bitmapbutton_new_from_data( "A button from data", 0, folder_ico, 1718 ); 1640 abutton1 = dw_bitmapbutton_new_from_data("A button from data", 0, folder_ico, 1718);
1633 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1641 dw_box_pack_start(filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
1634 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(percent_button_box_callback), NULL ); 1642 dw_signal_connect(abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(percent_button_box_callback), NULL);
1635 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); 1643 dw_box_pack_start(filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 );
1636 if ( redraw ) 1644 if(redraw)
1637 { 1645 {
1638 dw_window_redraw( filetoolbarbox ); 1646 dw_window_redraw(filetoolbarbox);
1639 dw_window_redraw( mainwindow ); 1647 dw_window_redraw(mainwindow);
1640 } 1648 }
1641 } 1649 }
1642 1650
1643 #ifdef DW_INCLUDE_DEPRECATED 1651 #ifdef DW_INCLUDE_DEPRECATED
1644 void mdi_add(void) 1652 void mdi_add(void)
1663 dw_window_show(mdi1w); 1671 dw_window_show(mdi1w);
1664 1672
1665 mdi2w = dw_window_new(mdi, "MDI2", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); 1673 mdi2w = dw_window_new(mdi, "MDI2", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX);
1666 mdi2box = dw_box_new(DW_HORZ, 0); 1674 mdi2box = dw_box_new(DW_HORZ, 0);
1667 dw_box_pack_start(mdi2w, mdi2box, 0, 0, TRUE, TRUE, 0); 1675 dw_box_pack_start(mdi2w, mdi2box, 0, 0, TRUE, TRUE, 0);
1668 ef = dw_entryfield_new( "", 0); 1676 ef = dw_entryfield_new("", 0);
1669 dw_box_pack_start(mdi2box, ef, 150, 30, FALSE, FALSE, 4); 1677 dw_box_pack_start(mdi2box, ef, 150, 30, FALSE, FALSE, 4);
1670 bb = dw_button_new("Browse", 0); 1678 bb = dw_button_new("Browse", 0);
1671 dw_box_pack_start(mdi2box, bb, 60, 30, FALSE, FALSE, 4); 1679 dw_box_pack_start(mdi2box, bb, 60, 30, FALSE, FALSE, 4);
1672 dw_window_set_size(mdi2w, 200, 200); 1680 dw_window_set_size(mdi2w, 200, 200);
1673 dw_window_show(mdi2w); 1681 dw_window_show(mdi2w);
1676 1684
1677 void menu_add(void) 1685 void menu_add(void)
1678 { 1686 {
1679 HMENUI menuitem,menu; 1687 HMENUI menuitem,menu;
1680 1688
1681 mainmenubar = dw_menubar_new( mainwindow ); 1689 mainmenubar = dw_menubar_new(mainwindow);
1682 /* add menus to the menubar */ 1690 /* add menus to the menubar */
1683 menu = dw_menu_new( 0 ); 1691 menu = dw_menu_new(0);
1684 menuitem = dw_menu_append_item( menu, "~Quit", 1019, 0, TRUE, FALSE, 0 ); 1692 menuitem = dw_menu_append_item( menu, "~Quit", 1019, 0, TRUE, FALSE, 0);
1685 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), DW_POINTER(mainwindow)); 1693 dw_signal_connect(menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), DW_POINTER(mainwindow));
1686 /* 1694 /*
1687 * Add the "File" menu to the menubar... 1695 * Add the "File" menu to the menubar...
1688 */ 1696 */
1689 dw_menu_append_item( mainmenubar, "~File", 1010, 0, TRUE, FALSE, menu ); 1697 dw_menu_append_item(mainmenubar, "~File", 1010, 0, TRUE, FALSE, menu);
1690 1698
1691 changeable_menu = dw_menu_new( 0 ); 1699 changeable_menu = dw_menu_new(0);
1692 checkable_menuitem = dw_menu_append_item( changeable_menu, "~Checkable Menu Item", CHECKABLE_MENUITEMID, 0, TRUE, TRUE, 0 ); 1700 checkable_menuitem = dw_menu_append_item(changeable_menu, "~Checkable Menu Item", CHECKABLE_MENUITEMID, 0, TRUE, TRUE, 0);
1693 dw_signal_connect( checkable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), DW_POINTER("checkable")); 1701 dw_signal_connect( checkable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), DW_POINTER("checkable"));
1694 noncheckable_menuitem = dw_menu_append_item( changeable_menu, "~Non-checkable Menu Item", NONCHECKABLE_MENUITEMID, 0, TRUE, FALSE, 0 ); 1702 noncheckable_menuitem = dw_menu_append_item(changeable_menu, "~Non-checkable Menu Item", NONCHECKABLE_MENUITEMID, 0, TRUE, FALSE, 0);
1695 dw_signal_connect( noncheckable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), DW_POINTER("non-checkable")); 1703 dw_signal_connect(noncheckable_menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_callback), DW_POINTER("non-checkable"));
1696 dw_menu_append_item( changeable_menu, "~Disabled menu Item", 2003, DW_MIS_DISABLED|DW_MIS_CHECKED, TRUE, TRUE, 0 ); 1704 dw_menu_append_item(changeable_menu, "~Disabled menu Item", 2003, DW_MIS_DISABLED|DW_MIS_CHECKED, TRUE, TRUE, 0);
1697 /* seperator */ 1705 /* seperator */
1698 dw_menu_append_item( changeable_menu, DW_MENU_SEPARATOR, 3999, 0, TRUE, FALSE, 0 ); 1706 dw_menu_append_item(changeable_menu, DW_MENU_SEPARATOR, 3999, 0, TRUE, FALSE, 0);
1699 menuitem = dw_menu_append_item( changeable_menu, "~Menu Items Disabled", 2009, 0, TRUE, TRUE, 0 ); 1707 menuitem = dw_menu_append_item(changeable_menu, "~Menu Items Disabled", 2009, 0, TRUE, TRUE, 0);
1700 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menutoggle_callback), NULL); 1708 dw_signal_connect(menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menutoggle_callback), NULL);
1701 /* 1709 /*
1702 * Add the "Menu" menu to the menubar... 1710 * Add the "Menu" menu to the menubar...
1703 */ 1711 */
1704 dw_menu_append_item( mainmenubar, "~Menu", 1020, 0, TRUE, FALSE, changeable_menu ); 1712 dw_menu_append_item(mainmenubar, "~Menu", 1020, 0, TRUE, FALSE, changeable_menu);
1705 1713
1706 menu = dw_menu_new( 0 ); 1714 menu = dw_menu_new(0);
1707 menuitem = dw_menu_append_item( menu, "~About", 1091, 0, TRUE, FALSE, 0 ); 1715 menuitem = dw_menu_append_item(menu, "~About", 1091, 0, TRUE, FALSE, 0);
1708 dw_signal_connect( menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(helpabout_callback), DW_POINTER(mainwindow)); 1716 dw_signal_connect(menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(helpabout_callback), DW_POINTER(mainwindow));
1709 /* 1717 /*
1710 * Add the "Help" menu to the menubar... 1718 * Add the "Help" menu to the menubar...
1711 */ 1719 */
1712 dw_menu_append_item( mainmenubar, "~Help", 1090, 0, TRUE, FALSE, menu ); 1720 dw_menu_append_item(mainmenubar, "~Help", 1090, 0, TRUE, FALSE, menu);
1713 } 1721 }
1714 1722
1715 int DWSIGNAL scrollbox_button_callback(HWND window, void *data) 1723 int DWSIGNAL scrollbox_button_callback(HWND window, void *data)
1716 { 1724 {
1717 int pos, range; 1725 int pos, range;
1718 1726
1719 pos = dw_scrollbox_get_pos( scrollbox, DW_VERT ); 1727 pos = dw_scrollbox_get_pos(scrollbox, DW_VERT);
1720 range = dw_scrollbox_get_range( scrollbox, DW_VERT ); 1728 range = dw_scrollbox_get_range(scrollbox, DW_VERT);
1721 dw_debug("Pos %d Range %d\n", pos, range ); 1729 dw_debug("Pos %d Range %d\n", pos, range);
1722 return 0; 1730 return 0;
1723 } 1731 }
1724 1732
1725 void scrollbox_add(void) 1733 void scrollbox_add(void)
1726 { 1734 {
1730 1738
1731 /* create a box to pack into the notebook page */ 1739 /* create a box to pack into the notebook page */
1732 scrollbox = dw_scrollbox_new(DW_VERT, 0); 1740 scrollbox = dw_scrollbox_new(DW_VERT, 0);
1733 dw_box_pack_start(notebookbox8, scrollbox, 0, 0, TRUE, TRUE, 1); 1741 dw_box_pack_start(notebookbox8, scrollbox, 0, 0, TRUE, TRUE, 1);
1734 1742
1735 abutton1 = dw_button_new( "Show Adjustments", 0 ); 1743 abutton1 = dw_button_new("Show Adjustments", 0);
1736 dw_box_pack_start( scrollbox, abutton1, -1, 30, FALSE, FALSE, 0 ); 1744 dw_box_pack_start(scrollbox, abutton1, -1, 30, FALSE, FALSE, 0);
1737 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(scrollbox_button_callback), NULL ); 1745 dw_signal_connect(abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(scrollbox_button_callback), NULL);
1738 1746
1739 for ( i = 0; i < MAX_WIDGETS; i++ ) 1747 for(i = 0; i < MAX_WIDGETS; i++)
1740 { 1748 {
1741 tmpbox = dw_box_new( DW_HORZ, 0 ); 1749 tmpbox = dw_box_new(DW_HORZ, 0);
1742 dw_box_pack_start( scrollbox, tmpbox, 0, 24, TRUE, FALSE, 2); 1750 dw_box_pack_start(scrollbox, tmpbox, 0, 24, TRUE, FALSE, 2);
1743 sprintf( buf, "Label %d", i ); 1751 sprintf(buf, "Label %d", i);
1744 labelarray[i] = dw_text_new( buf , 0 ); 1752 labelarray[i] = dw_text_new(buf , 0);
1745 dw_box_pack_start( tmpbox, labelarray[i], 0, 20, TRUE, FALSE, 0); 1753 dw_box_pack_start( tmpbox, labelarray[i], 0, 20, TRUE, FALSE, 0);
1746 sprintf( buf, "Entry %d", i ); 1754 sprintf(buf, "Entry %d", i);
1747 entryarray[i] = dw_entryfield_new( buf , i ); 1755 entryarray[i] = dw_entryfield_new(buf , i);
1748 dw_box_pack_start( tmpbox, entryarray[i], 0, 20, TRUE, FALSE, 0); 1756 dw_box_pack_start(tmpbox, entryarray[i], 0, 20, TRUE, FALSE, 0);
1749 } 1757 }
1750 } 1758 }
1751 1759
1752 /* Section for thread/event test */ 1760 /* Section for thread/event test */
1753 HWND threadmle, startbutton; 1761 HWND threadmle, startbutton;
1801 /* create a box to pack into the notebook page */ 1809 /* create a box to pack into the notebook page */
1802 tmpbox = dw_box_new(DW_VERT, 0); 1810 tmpbox = dw_box_new(DW_VERT, 0);
1803 dw_box_pack_start(notebookbox9, tmpbox, 0, 0, TRUE, TRUE, 1); 1811 dw_box_pack_start(notebookbox9, tmpbox, 0, 0, TRUE, TRUE, 1);
1804 1812
1805 startbutton = dw_button_new( "Start Threads", 0 ); 1813 startbutton = dw_button_new( "Start Threads", 0 );
1806 dw_box_pack_start( tmpbox, startbutton, -1, 30, FALSE, FALSE, 0 ); 1814 dw_box_pack_start(tmpbox, startbutton, -1, 30, FALSE, FALSE, 0);
1807 dw_signal_connect( startbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(start_threads_button_callback), NULL ); 1815 dw_signal_connect(startbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(start_threads_button_callback), NULL);
1808 1816
1809 /* Create the base threading components */ 1817 /* Create the base threading components */
1810 threadmle = dw_mle_new(0); 1818 threadmle = dw_mle_new(0);
1811 dw_box_pack_start(tmpbox, threadmle, 1, 1, TRUE, TRUE, 0); 1819 dw_box_pack_start(tmpbox, threadmle, 1, 1, TRUE, TRUE, 0);
1812 mutex = dw_mutex_new(); 1820 mutex = dw_mutex_new();
2056 "Supports status text area on notebook/tabbed controls", 2064 "Supports status text area on notebook/tabbed controls",
2057 "Supports sending system notifications", 2065 "Supports sending system notifications",
2058 "Supports UTF8 encoded Unicode text", 2066 "Supports UTF8 encoded Unicode text",
2059 "Supports Rich Edit based MLE control (Windows)", 2067 "Supports Rich Edit based MLE control (Windows)",
2060 "Supports icons in the taskbar or similar system widget", 2068 "Supports icons in the taskbar or similar system widget",
2069 "Supports the Tree Widget",
2061 NULL }; 2070 NULL };
2062 2071
2063 /* 2072 /*
2064 * Let's demonstrate the functionality of this library. :) 2073 * Let's demonstrate the functionality of this library. :)
2065 */ 2074 */