comparison dwtest.c @ 634:c6a216c8174f

Support for setting transparent colour for bitmaps Support for checkable menu items Mouse support on render window Fix bubble text on buttons dw_window_set_text() works for group box dw_window_set_size() and dw_window_set_pos_size() to allow negative values Add dw_draw_polygon()
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 10 Apr 2009 10:25:26 +0000
parents a5deb87b26e4
children f6f887d2c5aa
comparison
equal deleted inserted replaced
633:87db549e79bc 634:c6a216c8174f
124 treebox, 124 treebox,
125 containerbox, 125 containerbox,
126 textbox1, textbox2, textboxA, 126 textbox1, textbox2, textboxA,
127 gap_box, 127 gap_box,
128 buttonbox, 128 buttonbox,
129 buttonsbox,
129 buttonboxperm, 130 buttonboxperm,
130 cal, 131 cal,
131 filetoolbarbox; 132 filetoolbarbox;
132 133
133 HMENUI mainmenubar,changeable_menu; 134 HMENUI mainmenubar,changeable_menu;
478 } 479 }
479 480
480 int DWSIGNAL redraw_button_box_callback(HWND window, void *data) 481 int DWSIGNAL redraw_button_box_callback(HWND window, void *data)
481 { 482 {
482 #if 0 483 #if 0
484
485 long x, y, width, height;
486 dw_window_get_pos_size(filetoolbarbox , &x, &y, &width, &height);
483 dw_window_destroy( filetoolbarbox ); 487 dw_window_destroy( filetoolbarbox );
484 create_button(1); 488 create_button(1);
489 dw_window_set_pos_size(filetoolbarbox, x, y, width, height);
485 #else 490 #else
486 dw_window_enable( window); 491 dw_window_enable( window);
492 dw_menu_delete_item( changeable_menu, NONCHECKABLE_MENUITEMID );
487 #endif 493 #endif
488 return 0; 494 return 0;
489 } 495 }
496
497 int DWSIGNAL change_color_red_callback(HWND window, void *data)
498 {
499 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED);
500 return 0;
501 }
502
503 int DWSIGNAL change_color_yellow_callback(HWND window, void *data)
504 {
505 dw_window_set_color(buttonsbox, DW_CLR_YELLOW, DW_CLR_YELLOW);
506 return 0;
507 }
508
490 509
491 /* Callback to handle user selection of the scrollbar position */ 510 /* Callback to handle user selection of the scrollbar position */
492 void DWSIGNAL scrollbar_valuechanged_callback(HWND hwnd, int value, void *data) 511 void DWSIGNAL scrollbar_valuechanged_callback(HWND hwnd, int value, void *data)
493 { 512 {
494 if(data) 513 if(data)
900 } 919 }
901 920
902 921
903 void buttons_add(void) 922 void buttons_add(void)
904 { 923 {
905 HWND buttonsbox,abutton1,abutton2,calbox,bw; 924 HWND abutton1,abutton2,calbox,bw;
906 int i; 925 int i;
907 char buf[20]; 926 char buf[20];
908 char **text; 927 char **text;
909 928
910 /* create a box to pack into the notebook page */ 929 /* create a box to pack into the notebook page */
930 // buttonsbox = dw_scrollbox_new(BOXVERT, 2);
911 buttonsbox = dw_box_new(BOXVERT, 2); 931 buttonsbox = dw_box_new(BOXVERT, 2);
912 dw_box_pack_start( notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0); 932 dw_box_pack_start( notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0);
913 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED); 933 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED);
914 934
915 calbox = dw_box_new(DW_HORZ, 0); 935 calbox = dw_box_new(DW_HORZ, 0);
923 * Create our file toolbar boxes... 943 * Create our file toolbar boxes...
924 */ 944 */
925 buttonboxperm = dw_box_new( BOXVERT, 0 ); 945 buttonboxperm = dw_box_new( BOXVERT, 0 );
926 dw_box_pack_start( buttonsbox, buttonboxperm, 25, 0, FALSE, TRUE, 2 ); 946 dw_box_pack_start( buttonsbox, buttonboxperm, 25, 0, FALSE, TRUE, 2 );
927 dw_window_set_color(buttonboxperm, DW_CLR_WHITE, DW_CLR_WHITE); 947 dw_window_set_color(buttonboxperm, DW_CLR_WHITE, DW_CLR_WHITE);
928 abutton1 = dw_bitmapbutton_new_from_file( "Top Button", 0, FILE_ICON_NAME ); 948 // abutton1 = dw_bitmapbutton_new_from_file( "Top Button", 0, FILE_ICON_NAME );
949 abutton1 = dw_bitmapbutton_new_from_file( "Top Button", 0, "z:\\projects\\RexxGd\\regina\\tile_up.png" );
929 dw_box_pack_start( buttonboxperm, abutton1, 100, 30, FALSE, FALSE, 0 ); 950 dw_box_pack_start( buttonboxperm, abutton1, 100, 30, FALSE, FALSE, 0 );
930 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); 951 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL );
931 dw_box_pack_start( buttonboxperm, 0, 25, 5, FALSE, FALSE, 0 ); 952 dw_box_pack_start( buttonboxperm, 0, 25, 5, FALSE, FALSE, 0 );
932 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, FOLDER_ICON_NAME ); 953 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, FOLDER_ICON_NAME );
933 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 ); 954 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 );
994 filetoolbarbox = dw_box_new( BOXVERT, 0 ); 1015 filetoolbarbox = dw_box_new( BOXVERT, 0 );
995 dw_box_pack_start( buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0 ); 1016 dw_box_pack_start( buttonboxperm, filetoolbarbox, 0, 0, TRUE, TRUE, 0 );
996 1017
997 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); 1018 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" );
998 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1019 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
999 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(redraw_button_box_callback), NULL ); 1020 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_red_callback), NULL );
1000 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); 1021 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 );
1001 1022
1002 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); 1023 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" );
1003 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1024 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
1004 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(redraw_button_box_callback), NULL ); 1025 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_yellow_callback), NULL );
1005 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); 1026 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 );
1006 1027
1007 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" ); 1028 abutton1 = dw_bitmapbutton_new_from_file( "Should be under Top button", 0, "junk" );
1008 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); 1029 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0);
1009 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(redraw_button_box_callback), NULL ); 1030 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(redraw_button_box_callback), NULL );
1165 * Instead a pure HTML based web page is displayed. MHES 5/4/2008 1186 * Instead a pure HTML based web page is displayed. MHES 5/4/2008
1166 */ 1187 */
1167 dw_html_url(html, "http://www.rexx.org"); 1188 dw_html_url(html, "http://www.rexx.org");
1168 1189
1169 dw_signal_connect(mainwindow, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); 1190 dw_signal_connect(mainwindow, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow);
1170 timerid = dw_timer_connect(1000, DW_SIGNAL_FUNC(timer_callback), 0); 1191 timerid = dw_timer_connect(2000, DW_SIGNAL_FUNC(timer_callback), 0);
1171 dw_window_set_size(mainwindow, 640, 520); 1192 dw_window_set_size(mainwindow, 640, 520);
1172 dw_window_show(mainwindow); 1193 dw_window_show(mainwindow);
1173 1194
1174 dw_main(); 1195 dw_main();
1175 1196