comparison dwtest.c @ 1738:d93e860c38d1

Add code to show borderless bitmapbutton.
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 18 May 2012 06:58:21 +0000
parents 1a7b9b96d9d7
children 1b3b059a74b1
comparison
equal deleted inserted replaced
1737:46c2846e5750 1738:d93e860c38d1
361 int width = (int)DW_PIXMAP_WIDTH(hpm), height = (int)DW_PIXMAP_HEIGHT(hpm); 361 int width = (int)DW_PIXMAP_WIDTH(hpm), height = (int)DW_PIXMAP_HEIGHT(hpm);
362 HPIXMAP pixmap = direct ? NULL : hpm; 362 HPIXMAP pixmap = direct ? NULL : hpm;
363 HWND window = direct ? textbox2 : 0; 363 HWND window = direct ? textbox2 : 0;
364 int x[7] = { 20, 180, 180, 230, 180, 180, 20 }; 364 int x[7] = { 20, 180, 180, 230, 180, 180, 20 };
365 int y[7] = { 50, 50, 20, 70, 120, 90, 90 }; 365 int y[7] = { 50, 50, 20, 70, 120, 90, 90 };
366 366
367 image_x = (int)dw_spinbutton_get_pos(imagexspin); 367 image_x = (int)dw_spinbutton_get_pos(imagexspin);
368 image_y = (int)dw_spinbutton_get_pos(imageyspin); 368 image_y = (int)dw_spinbutton_get_pos(imageyspin);
369 image_stretch = dw_checkbox_get(imagestretchcheck); 369 image_stretch = dw_checkbox_get(imagestretchcheck);
370 370
371 dw_color_foreground_set(DW_CLR_WHITE); 371 dw_color_foreground_set(DW_CLR_WHITE);
430 } 430 }
431 else if(page_num == 1) 431 else if(page_num == 1)
432 { 432 {
433 /* Get the font size for this printer context... */ 433 /* Get the font size for this printer context... */
434 int fheight, fwidth; 434 int fheight, fwidth;
435 435
436 /* If we have a file to display... */ 436 /* If we have a file to display... */
437 if(current_file) 437 if(current_file)
438 { 438 {
439 int nrows; 439 int nrows;
440 440
441 /* Calculate new dimensions */ 441 /* Calculate new dimensions */
442 dw_font_text_extents_get(0, pixmap, "(g", NULL, &fheight); 442 dw_font_text_extents_get(0, pixmap, "(g", NULL, &fheight);
443 nrows = (int)(DW_PIXMAP_HEIGHT(pixmap) / fheight); 443 nrows = (int)(DW_PIXMAP_HEIGHT(pixmap) / fheight);
444 444
445 /* Do the actual drawing */ 445 /* Do the actual drawing */
446 draw_file(0, 0, nrows, fheight, pixmap); 446 draw_file(0, 0, nrows, fheight, pixmap);
447 } 447 }
448 else 448 else
449 { 449 {
450 /* We don't have a file so center an error message on the page */ 450 /* We don't have a file so center an error message on the page */
451 char *text = "No file currently selected!"; 451 char *text = "No file currently selected!";
452 int posx, posy; 452 int posx, posy;
453 453
454 dw_font_text_extents_get(0, pixmap, text, &fwidth, &fheight); 454 dw_font_text_extents_get(0, pixmap, text, &fwidth, &fheight);
455 455
456 posx = (int)(DW_PIXMAP_WIDTH(pixmap) - fwidth)/2; 456 posx = (int)(DW_PIXMAP_WIDTH(pixmap) - fwidth)/2;
457 posy = (int)(DW_PIXMAP_HEIGHT(pixmap) - fheight)/2; 457 posy = (int)(DW_PIXMAP_HEIGHT(pixmap) - fheight)/2;
458 458
459 dw_color_foreground_set(DW_CLR_BLACK); 459 dw_color_foreground_set(DW_CLR_BLACK);
460 dw_color_background_set(DW_CLR_WHITE); 460 dw_color_background_set(DW_CLR_WHITE);
461 dw_draw_text(0, pixmap, posx, posy, text); 461 dw_draw_text(0, pixmap, posx, posy, text);
462 } 462 }
463 } 463 }
708 text2pm = dw_pixmap_new(textbox2, (unsigned long)width, (unsigned long)height, (int)depth); 708 text2pm = dw_pixmap_new(textbox2, (unsigned long)width, (unsigned long)height, (int)depth);
709 709
710 /* Make sure the side area is cleared */ 710 /* Make sure the side area is cleared */
711 dw_color_foreground_set(DW_CLR_WHITE); 711 dw_color_foreground_set(DW_CLR_WHITE);
712 dw_draw_rect(0, text1pm, DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, (int)DW_PIXMAP_WIDTH(text1pm), (int)DW_PIXMAP_HEIGHT(text1pm)); 712 dw_draw_rect(0, text1pm, DW_DRAW_FILL | DW_DRAW_NOAA, 0, 0, (int)DW_PIXMAP_WIDTH(text1pm), (int)DW_PIXMAP_HEIGHT(text1pm));
713 713
714 /* Destroy the old pixmaps */ 714 /* Destroy the old pixmaps */
715 dw_pixmap_destroy(old1); 715 dw_pixmap_destroy(old1);
716 dw_pixmap_destroy(old2); 716 dw_pixmap_destroy(old2);
717 717
718 /* Update scrollbar ranges with new values */ 718 /* Update scrollbar ranges with new values */
757 int DWSIGNAL item_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata ) 757 int DWSIGNAL item_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata )
758 { 758 {
759 char buf[200]; 759 char buf[200];
760 HWND statline = (HWND)data; 760 HWND statline = (HWND)data;
761 761
762 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", DW_POINTER_TO_UINT(window), 762 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", DW_POINTER_TO_UINT(window),
763 DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) ); 763 DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) );
764 dw_window_set_text( statline, buf); 764 dw_window_set_text( statline, buf);
765 return 0; 765 return 0;
766 } 766 }
767 767
770 char buf[200]; 770 char buf[200];
771 char *str; 771 char *str;
772 HWND statline = (HWND)data; 772 HWND statline = (HWND)data;
773 unsigned long size; 773 unsigned long size;
774 774
775 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", DW_POINTER_TO_UINT(window), 775 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", DW_POINTER_TO_UINT(window),
776 DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) ); 776 DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) );
777 dw_window_set_text( statline, buf); 777 dw_window_set_text( statline, buf);
778 sprintf(buf,"\r\nDW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x\r\n", DW_POINTER_TO_UINT(window), 778 sprintf(buf,"\r\nDW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x\r\n", DW_POINTER_TO_UINT(window),
779 DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) ); 779 DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) );
780 mle_point = dw_mle_import( container_mle, buf, mle_point); 780 mle_point = dw_mle_import( container_mle, buf, mle_point);
781 str = dw_container_query_start(container, DW_CRA_SELECTED); 781 str = dw_container_query_start(container, DW_CRA_SELECTED);
782 while(str) 782 while(str)
783 { 783 {
786 str = dw_container_query_next(container, DW_CRA_SELECTED); 786 str = dw_container_query_next(container, DW_CRA_SELECTED);
787 } 787 }
788 /* Make the last inserted point the cursor location */ 788 /* Make the last inserted point the cursor location */
789 dw_mle_set_cursor(container_mle, mle_point); 789 dw_mle_set_cursor(container_mle, mle_point);
790 /* set the details of item 0 to new data */ 790 /* set the details of item 0 to new data */
791 dw_debug("In cb: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container), 791 dw_debug("In cb: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container),
792 DW_POINTER_TO_INT(containerinfo), DW_POINTER_TO_INT(fileicon)); 792 DW_POINTER_TO_INT(containerinfo), DW_POINTER_TO_INT(fileicon));
793 dw_filesystem_change_file(container, 0, "new data", fileicon); 793 dw_filesystem_change_file(container, 0, "new data", fileicon);
794 size = 999; 794 size = 999;
795 dw_debug("In cb: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container), 795 dw_debug("In cb: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container),
796 DW_POINTER_TO_INT(containerinfo), DW_POINTER_TO_INT(fileicon)); 796 DW_POINTER_TO_INT(containerinfo), DW_POINTER_TO_INT(fileicon));
797 dw_filesystem_change_item(container, 1, 0, &size); 797 dw_filesystem_change_item(container, 1, 0, &size);
798 return 0; 798 return 0;
799 } 799 }
800 800
801 int DWSIGNAL switch_page_cb( HWND window, unsigned long page_num, void *itemdata ) 801 int DWSIGNAL switch_page_cb( HWND window, unsigned long page_num, void *itemdata )
802 { 802 {
803 dw_debug("DW_SIGNAL_SWITCH_PAGE: Window: %x PageNum: %u Itemdata: %x\n", DW_POINTER_TO_UINT(window), 803 dw_debug("DW_SIGNAL_SWITCH_PAGE: Window: %x PageNum: %u Itemdata: %x\n", DW_POINTER_TO_UINT(window),
804 DW_POINTER_TO_UINT(page_num), DW_POINTER_TO_UINT(itemdata) ); 804 DW_POINTER_TO_UINT(page_num), DW_POINTER_TO_UINT(itemdata) );
805 return 0; 805 return 0;
806 } 806 }
807 807
808 int DWSIGNAL column_click_cb( HWND window, int column_num, void *data ) 808 int DWSIGNAL column_click_cb( HWND window, int column_num, void *data )
827 else if( column_type == DW_CFA_BITMAPORICON) 827 else if( column_type == DW_CFA_BITMAPORICON)
828 strcpy(buf1,"BitmapOrIcon"); 828 strcpy(buf1,"BitmapOrIcon");
829 else 829 else
830 strcpy(buf1,"Unknown"); 830 strcpy(buf1,"Unknown");
831 } 831 }
832 sprintf(buf,"DW_SIGNAL_COLUMN_CLICK: Window: %x Column: %d Type: %s Itemdata: %x", DW_POINTER_TO_UINT(window), 832 sprintf(buf,"DW_SIGNAL_COLUMN_CLICK: Window: %x Column: %d Type: %s Itemdata: %x", DW_POINTER_TO_UINT(window),
833 column_num, buf1, DW_POINTER_TO_UINT(data) ); 833 column_num, buf1, DW_POINTER_TO_UINT(data) );
834 dw_window_set_text( statline, buf); 834 dw_window_set_text( statline, buf);
835 return 0; 835 return 0;
836 } 836 }
837 837
882 882
883 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); 883 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0);
884 884
885 cancelbutton = dw_button_new("Exit", 1002L); 885 cancelbutton = dw_button_new("Exit", 1002L);
886 dw_box_pack_start(buttonbox, cancelbutton, 130, 30, TRUE, TRUE, 2); 886 dw_box_pack_start(buttonbox, cancelbutton, 130, 30, TRUE, TRUE, 2);
887 887
888 cursortogglebutton = dw_button_new("Set Cursor pointer - CLOCK", 1003L); 888 cursortogglebutton = dw_button_new("Set Cursor pointer - CLOCK", 1003L);
889 dw_box_pack_start(buttonbox, cursortogglebutton, 130, 30, TRUE, TRUE, 2); 889 dw_box_pack_start(buttonbox, cursortogglebutton, 130, 30, TRUE, TRUE, 2);
890 890
891 okbutton = dw_button_new("Turn Off Annoying Beep!", 1001L); 891 okbutton = dw_button_new("Turn Off Annoying Beep!", 1001L);
892 dw_box_pack_start(buttonbox, okbutton, 130, 30, TRUE, TRUE, 2); 892 dw_box_pack_start(buttonbox, okbutton, 130, 30, TRUE, TRUE, 2);
933 int API context_menu_event(HWND window, int x, int y, int buttonmask, void *data) 933 int API context_menu_event(HWND window, int x, int y, int buttonmask, void *data)
934 { 934 {
935 HMENUI hwndMenu = dw_menu_new(0L); 935 HMENUI hwndMenu = dw_menu_new(0L);
936 HWND menuitem = dw_menu_append_item(hwndMenu, "~Quit", DW_MENU_POPUP, 0L, TRUE, FALSE, DW_NOMENU); 936 HWND menuitem = dw_menu_append_item(hwndMenu, "~Quit", DW_MENU_POPUP, 0L, TRUE, FALSE, DW_NOMENU);
937 long px, py; 937 long px, py;
938 938
939 dw_signal_connect(menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), DW_POINTER(mainwindow)); 939 dw_signal_connect(menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), DW_POINTER(mainwindow));
940 dw_menu_append_item(hwndMenu, DW_MENU_SEPARATOR, DW_MENU_POPUP, 0L, TRUE, FALSE, DW_NOMENU); 940 dw_menu_append_item(hwndMenu, DW_MENU_SEPARATOR, DW_MENU_POPUP, 0L, TRUE, FALSE, DW_NOMENU);
941 menuitem = dw_menu_append_item(hwndMenu, "~Show Window", DW_MENU_POPUP, 0L, TRUE, FALSE, DW_NOMENU); 941 menuitem = dw_menu_append_item(hwndMenu, "~Show Window", DW_MENU_POPUP, 0L, TRUE, FALSE, DW_NOMENU);
942 dw_signal_connect(menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(show_window_callback), DW_POINTER(mainwindow)); 942 dw_signal_connect(menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(show_window_callback), DW_POINTER(mainwindow));
943 dw_pointer_query_pos(&px, &py); 943 dw_pointer_query_pos(&px, &py);
999 /* Pre-create the scrollbars so we can query their sizes */ 999 /* Pre-create the scrollbars so we can query their sizes */
1000 vscrollbar = dw_scrollbar_new(DW_VERT, 50); 1000 vscrollbar = dw_scrollbar_new(DW_VERT, 50);
1001 hscrollbar = dw_scrollbar_new(DW_HORZ, 50); 1001 hscrollbar = dw_scrollbar_new(DW_HORZ, 50);
1002 dw_window_get_preferred_size(vscrollbar, &vscrollbarwidth, NULL); 1002 dw_window_get_preferred_size(vscrollbar, &vscrollbarwidth, NULL);
1003 dw_window_get_preferred_size(hscrollbar, NULL, &hscrollbarheight); 1003 dw_window_get_preferred_size(hscrollbar, NULL, &hscrollbarheight);
1004 1004
1005 /* On GTK with overlay scrollbars enabled this returns us 0... 1005 /* On GTK with overlay scrollbars enabled this returns us 0...
1006 * so in that case we need to give it some real values. 1006 * so in that case we need to give it some real values.
1007 */ 1007 */
1008 if(!vscrollbarwidth) 1008 if(!vscrollbarwidth)
1009 vscrollbarwidth = 8; 1009 vscrollbarwidth = 8;
1010 if(!hscrollbarheight) 1010 if(!hscrollbarheight)
1011 hscrollbarheight = 8; 1011 hscrollbarheight = 8;
1012 1012
1013 /* create render box for number pixmap */ 1013 /* create render box for number pixmap */
1014 textbox1 = dw_render_new( 100 ); 1014 textbox1 = dw_render_new( 100 );
1015 dw_window_set_font(textbox1, FIXEDFONT); 1015 dw_window_set_font(textbox1, FIXEDFONT);
1016 dw_font_text_extents_get(textbox1, NULL, "(g", &font_width, &font_height); 1016 dw_font_text_extents_get(textbox1, NULL, "(g", &font_width, &font_height);
1017 font_width = font_width / 2; 1017 font_width = font_width / 2;
1063 dw_signal_connect(imagestretchcheck, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(refresh_callback), NULL); 1063 dw_signal_connect(imagestretchcheck, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(refresh_callback), NULL);
1064 dw_signal_connect(button1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(refresh_callback), NULL); 1064 dw_signal_connect(button1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(refresh_callback), NULL);
1065 dw_signal_connect(button2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(print_callback), NULL); 1065 dw_signal_connect(button2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(print_callback), NULL);
1066 dw_signal_connect(rendcombo, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(render_select_event_callback), NULL ); 1066 dw_signal_connect(rendcombo, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(render_select_event_callback), NULL );
1067 dw_signal_connect(mainwindow, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(keypress_callback), NULL); 1067 dw_signal_connect(mainwindow, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(keypress_callback), NULL);
1068 1068
1069 dw_taskbar_insert(textbox1, fileicon, "DWTest"); 1069 dw_taskbar_insert(textbox1, fileicon, "DWTest");
1070 } 1070 }
1071 1071
1072 void tree_add(void) 1072 void tree_add(void)
1073 { 1073 {
1237 * Create our file toolbar boxes... 1237 * Create our file toolbar boxes...
1238 */ 1238 */
1239 buttonboxperm = dw_box_new( DW_VERT, 0 ); 1239 buttonboxperm = dw_box_new( DW_VERT, 0 );
1240 dw_box_pack_start( buttonsbox, buttonboxperm, 25, 0, FALSE, TRUE, 2 ); 1240 dw_box_pack_start( buttonsbox, buttonboxperm, 25, 0, FALSE, TRUE, 2 );
1241 dw_window_set_color(buttonboxperm, DW_CLR_WHITE, DW_CLR_WHITE); 1241 dw_window_set_color(buttonboxperm, DW_CLR_WHITE, DW_CLR_WHITE);
1242 // abutton1 = dw_bitmapbutton_new_from_file( "Top Button", 0, FILE_ICON_NAME ); 1242 abutton1 = dw_bitmapbutton_new_from_file( "Top Button", 0, FILE_ICON_NAME );
1243 abutton1 = dw_bitmapbutton_new_from_file( "Top Button", 0, "z:\\projects\\RexxGd\\regina\\tile_up.png" );
1244 dw_box_pack_start( buttonboxperm, abutton1, 100, 30, FALSE, FALSE, 0 ); 1243 dw_box_pack_start( buttonboxperm, abutton1, 100, 30, FALSE, FALSE, 0 );
1245 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); 1244 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL );
1246 dw_box_pack_start( buttonboxperm, 0, 25, 5, FALSE, FALSE, 0 ); 1245 dw_box_pack_start( buttonboxperm, 0, 25, 5, FALSE, FALSE, 0 );
1247 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, FOLDER_ICON_NAME ); 1246 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, FOLDER_ICON_NAME );
1248 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 ); 1247 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 );
1313 { 1312 {
1314 HWND abutton1; 1313 HWND abutton1;
1315 filetoolbarbox = dw_box_new( DW_VERT, 0 ); 1314 filetoolbarbox = dw_box_new( DW_VERT, 0 );
1316 dw_box_pack_start( buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0 ); 1315 dw_box_pack_start( buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0 );
1317 1316
1318 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); 1317 abutton1 = dw_bitmapbutton_new_from_file( "Empty image. Should be under Top button", 0, "junk" );
1319 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1318 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
1320 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_red_callback), NULL ); 1319 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_red_callback), NULL );
1321 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); 1320 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 );
1322 1321
1323 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); 1322 abutton1 = dw_bitmapbutton_new_from_data( "A borderless bitmapbitton", 0, folder_ico, 1718 );
1324 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1323 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
1325 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_yellow_callback), NULL ); 1324 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_yellow_callback), NULL );
1326 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); 1325 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 );
1326 dw_window_set_style( abutton1, DW_BS_NOBORDER, DW_BS_NOBORDER );
1327 1327
1328 abutton1 = dw_bitmapbutton_new_from_data( "A button from data", 0, folder_ico, 1718 ); 1328 abutton1 = dw_bitmapbutton_new_from_data( "A button from data", 0, folder_ico, 1718 );
1329 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1329 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
1330 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(percent_button_box_callback), NULL ); 1330 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(percent_button_box_callback), NULL );
1331 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); 1331 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 );
1497 dw_box_pack_start(notebookbox9, tmpbox, 0, 0, TRUE, TRUE, 1); 1497 dw_box_pack_start(notebookbox9, tmpbox, 0, 0, TRUE, TRUE, 1);
1498 1498
1499 startbutton = dw_button_new( "Start Threads", 0 ); 1499 startbutton = dw_button_new( "Start Threads", 0 );
1500 dw_box_pack_start( tmpbox, startbutton, -1, 30, FALSE, FALSE, 0 ); 1500 dw_box_pack_start( tmpbox, startbutton, -1, 30, FALSE, FALSE, 0 );
1501 dw_signal_connect( startbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(start_threads_button_callback), NULL ); 1501 dw_signal_connect( startbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(start_threads_button_callback), NULL );
1502 1502
1503 /* Create the base threading components */ 1503 /* Create the base threading components */
1504 threadmle = dw_mle_new(0); 1504 threadmle = dw_mle_new(0);
1505 dw_box_pack_start(tmpbox, threadmle, 1, 1, TRUE, TRUE, 0); 1505 dw_box_pack_start(tmpbox, threadmle, 1, 1, TRUE, TRUE, 0);
1506 mutex = dw_mutex_new(); 1506 mutex = dw_mutex_new();
1507 workevent = dw_event_new(); 1507 workevent = dw_event_new();
1516 update_mle(buf, TRUE); 1516 update_mle(buf, TRUE);
1517 1517
1518 /* Increment the ready count while protected by mutex */ 1518 /* Increment the ready count while protected by mutex */
1519 dw_mutex_lock(mutex); 1519 dw_mutex_lock(mutex);
1520 ready++; 1520 ready++;
1521 /* If all 4 threads have incrememted the ready count... 1521 /* If all 4 threads have incrememted the ready count...
1522 * Post the control event semaphore so things will get started. 1522 * Post the control event semaphore so things will get started.
1523 */ 1523 */
1524 if(ready == 4) 1524 if(ready == 4)
1525 dw_event_post(controlevent); 1525 dw_event_post(controlevent);
1526 dw_mutex_unlock(mutex); 1526 dw_mutex_unlock(mutex);
1543 1543
1544 /* Increment the ready count while protected by mutex */ 1544 /* Increment the ready count while protected by mutex */
1545 dw_mutex_lock(mutex); 1545 dw_mutex_lock(mutex);
1546 ready++; 1546 ready++;
1547 sprintf(buf, "Thread %d work done. ready=%d", threadnum, ready); 1547 sprintf(buf, "Thread %d work done. ready=%d", threadnum, ready);
1548 /* If all 4 threads have incrememted the ready count... 1548 /* If all 4 threads have incrememted the ready count...
1549 * Post the control event semaphore so things will get started. 1549 * Post the control event semaphore so things will get started.
1550 */ 1550 */
1551 if(ready == 4) 1551 if(ready == 4)
1552 { 1552 {
1553 dw_event_post(controlevent); 1553 dw_event_post(controlevent);
1636 1636
1637 menu_add(); 1637 menu_add();
1638 1638
1639 notebookbox = dw_box_new( DW_VERT, 5 ); 1639 notebookbox = dw_box_new( DW_VERT, 5 );
1640 dw_box_pack_start( mainwindow, notebookbox, 0, 0, TRUE, TRUE, 0); 1640 dw_box_pack_start( mainwindow, notebookbox, 0, 0, TRUE, TRUE, 0);
1641 1641
1642 foldericon = dw_icon_load_from_file( FOLDER_ICON_NAME ); 1642 foldericon = dw_icon_load_from_file( FOLDER_ICON_NAME );
1643 fileicon = dw_icon_load_from_file( FILE_ICON_NAME ); 1643 fileicon = dw_icon_load_from_file( FILE_ICON_NAME );
1644 1644
1645 notebook = dw_notebook_new( 1, TRUE ); 1645 notebook = dw_notebook_new( 1, TRUE );
1646 dw_box_pack_start( notebookbox, notebook, 100, 100, TRUE, TRUE, 0); 1646 dw_box_pack_start( notebookbox, notebook, 100, 100, TRUE, TRUE, 0);
1647 dw_signal_connect(notebook, DW_SIGNAL_SWITCH_PAGE, DW_SIGNAL_FUNC(switch_page_cb), NULL); 1647 dw_signal_connect(notebook, DW_SIGNAL_SWITCH_PAGE, DW_SIGNAL_FUNC(switch_page_cb), NULL);
1648 1648
1649 notebookbox1 = dw_box_new( DW_VERT, 5 ); 1649 notebookbox1 = dw_box_new( DW_VERT, 5 );
1725 dw_main(); 1725 dw_main();
1726 1726
1727 /* Now that the loop is done we can cleanup */ 1727 /* Now that the loop is done we can cleanup */
1728 dw_taskbar_delete(textbox1, fileicon); 1728 dw_taskbar_delete(textbox1, fileicon);
1729 dw_window_destroy(mainwindow); 1729 dw_window_destroy(mainwindow);
1730 1730
1731 dw_debug("dwtest exiting...\n"); 1731 dw_debug("dwtest exiting...\n");
1732 /* Call dw_exit() to shutdown the Dynamic Windows engine */ 1732 /* Call dw_exit() to shutdown the Dynamic Windows engine */
1733 dw_exit(0); 1733 dw_exit(0);
1734 return 0; 1734 return 0;
1735 } 1735 }