Mercurial > dwindows
comparison dwtest.c @ 1190:76262040ed5f
Added DW_PERCENT_INDETERMINATE which can be passed to dw_percent_set_pos() to
show a rotating or otherwise indeterminate percent bar on supported platforms.
Platforms which don't support it will either show no progress or potentially
growing and contracting progress in the future if that doesn't look too weird.
Committed from Windows so may be fixes coming for the other platforms soon.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 28 Sep 2011 08:22:48 +0000 |
parents | ce83df520be0 |
children | 88b3f27542b0 |
comparison
equal
deleted
inserted
replaced
1189:c5419ef79a77 | 1190:76262040ed5f |
---|---|
70 combox, | 70 combox, |
71 combobox1, | 71 combobox1, |
72 combobox2, | 72 combobox2, |
73 spinbutton, | 73 spinbutton, |
74 slider, | 74 slider, |
75 percent, | |
75 notebookbox, | 76 notebookbox, |
76 notebookbox1, | 77 notebookbox1, |
77 notebookbox2, | 78 notebookbox2, |
78 notebookbox3, | 79 notebookbox3, |
79 notebookbox4, | 80 notebookbox4, |
568 dw_messagebox( "Values", DW_MB_OK | DW_MB_INFORMATION, buf3 ); | 569 dw_messagebox( "Values", DW_MB_OK | DW_MB_INFORMATION, buf3 ); |
569 dw_clipboard_set_text( buf3, len ); | 570 dw_clipboard_set_text( buf3, len ); |
570 return 0; | 571 return 0; |
571 } | 572 } |
572 | 573 |
573 int DWSIGNAL redraw_button_box_callback(HWND window, void *data) | 574 int DWSIGNAL percent_button_box_callback(HWND window, void *data) |
574 { | 575 { |
575 #if 0 | 576 dw_percent_set_pos(percent, DW_PERCENT_INDETERMINATE); |
576 | |
577 long x, y, width, height; | |
578 dw_window_get_pos_size(filetoolbarbox , &x, &y, &width, &height); | |
579 dw_window_destroy( filetoolbarbox ); | |
580 create_button(1); | |
581 dw_window_set_pos_size(filetoolbarbox, x, y, width, height); | |
582 #else | |
583 dw_window_enable( window); | |
584 dw_window_destroy( noncheckable_menuitem ); | |
585 #endif | |
586 return 0; | 577 return 0; |
587 } | 578 } |
588 | 579 |
589 int DWSIGNAL change_color_red_callback(HWND window, void *data) | 580 int DWSIGNAL change_color_red_callback(HWND window, void *data) |
590 { | 581 { |
627 } | 618 } |
628 | 619 |
629 /* Callback to handle user selection of the slider position */ | 620 /* Callback to handle user selection of the slider position */ |
630 void DWSIGNAL slider_valuechanged_callback(HWND hwnd, int value, void *data) | 621 void DWSIGNAL slider_valuechanged_callback(HWND hwnd, int value, void *data) |
631 { | 622 { |
632 dw_messagebox("DWTest", DW_MB_OK, "New value from slider: %d\n", value); | 623 dw_percent_set_pos(percent, value * 10); |
633 } | 624 } |
634 | 625 |
635 /* Handle size change of the main render window */ | 626 /* Handle size change of the main render window */ |
636 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data) | 627 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data) |
637 { | 628 { |
1191 dw_box_pack_start( combox, spinbutton, 200, 20, TRUE, FALSE, 0); | 1182 dw_box_pack_start( combox, spinbutton, 200, 20, TRUE, FALSE, 0); |
1192 dw_spinbutton_set_limits( spinbutton, 100, 1 ); | 1183 dw_spinbutton_set_limits( spinbutton, 100, 1 ); |
1193 dw_spinbutton_set_pos( spinbutton, 30 ); | 1184 dw_spinbutton_set_pos( spinbutton, 30 ); |
1194 dw_signal_connect( spinbutton, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(spinbutton_valuechanged_callback), NULL ); | 1185 dw_signal_connect( spinbutton, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(spinbutton_valuechanged_callback), NULL ); |
1195 /* make a slider */ | 1186 /* make a slider */ |
1196 slider = dw_slider_new( FALSE, 10, 0 ); /* no point in specifying text */ | 1187 slider = dw_slider_new( FALSE, 11, 0 ); /* no point in specifying text */ |
1197 dw_box_pack_start( combox, slider, 200, 20, TRUE, FALSE, 0); | 1188 dw_box_pack_start( combox, slider, 200, 20, TRUE, FALSE, 0); |
1198 dw_signal_connect( slider, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(slider_valuechanged_callback), NULL ); | 1189 dw_signal_connect( slider, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(slider_valuechanged_callback), NULL ); |
1190 /* make a percent */ | |
1191 percent = dw_percent_new( 0 ); | |
1192 dw_box_pack_start( combox, percent, 200, 20, TRUE, FALSE, 0); | |
1199 } | 1193 } |
1200 | 1194 |
1201 void create_button( int redraw) | 1195 void create_button( int redraw) |
1202 { | 1196 { |
1203 HWND abutton1; | 1197 HWND abutton1; |
1214 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_yellow_callback), NULL ); | 1208 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(change_color_yellow_callback), NULL ); |
1215 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); | 1209 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); |
1216 | 1210 |
1217 abutton1 = dw_bitmapbutton_new_from_data( "A button from data", 0, folder_ico, 1718 ); | 1211 abutton1 = dw_bitmapbutton_new_from_data( "A button from data", 0, folder_ico, 1718 ); |
1218 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); | 1212 dw_box_pack_start( filetoolbarbox, abutton1, 25, 25, FALSE, FALSE, 0); |
1219 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(redraw_button_box_callback), NULL ); | 1213 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(percent_button_box_callback), NULL ); |
1220 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); | 1214 dw_box_pack_start( filetoolbarbox, 0, 25, 5, FALSE, FALSE, 0 ); |
1221 if ( redraw ) | 1215 if ( redraw ) |
1222 { | 1216 { |
1223 dw_window_redraw( filetoolbarbox ); | 1217 dw_window_redraw( filetoolbarbox ); |
1224 dw_window_redraw( mainwindow ); | 1218 dw_window_redraw( mainwindow ); |