Mercurial > dwindows
comparison dwtest.c @ 602:489a684af1bb
Add some more test
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 25 Sep 2006 23:15:01 +0000 |
parents | d0e1db21e859 |
children | df01183257a0 |
comparison
equal
deleted
inserted
replaced
601:fe6490a13ed2 | 602:489a684af1bb |
---|---|
27 unsigned long flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR | | 27 unsigned long flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR | |
28 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER; | 28 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER; |
29 | 29 |
30 unsigned long current_color = DW_RGB(100,100,100); | 30 unsigned long current_color = DW_RGB(100,100,100); |
31 | 31 |
32 int iteration = 0; | |
32 void create_button( int); | 33 void create_button( int); |
33 | 34 |
34 #ifdef __MAC__ | 35 #ifdef __MAC__ |
35 int main(int argc, char *argv[]) | 36 int main(int argc, char *argv[]) |
36 { | 37 { |
56 cursortogglebutton, | 57 cursortogglebutton, |
57 colorchoosebutton, | 58 colorchoosebutton, |
58 okbutton, | 59 okbutton, |
59 cancelbutton, | 60 cancelbutton, |
60 lbbox, | 61 lbbox, |
62 combox, | |
63 combobox1, | |
64 combobox2, | |
65 spinbutton, | |
61 notebookbox, | 66 notebookbox, |
62 notebookbox1, | 67 notebookbox1, |
63 notebookbox2, | 68 notebookbox2, |
64 notebookbox3, | 69 notebookbox3, |
65 notebookbox4, | 70 notebookbox4, |
396 dw_window_set_text(stext, tmpbuf); | 401 dw_window_set_text(stext, tmpbuf); |
397 draw_file( current_row, current_col); | 402 draw_file( current_row, current_col); |
398 } | 403 } |
399 } | 404 } |
400 | 405 |
406 /* Callback to handle user selection of the spinbutton position */ | |
407 void DWSIGNAL spinbutton_valuechanged(HWND hwnd, int value, void *data) | |
408 { | |
409 dw_messagebox("DWTest", DW_MB_OK, "New value from spinbutton: %d\n", value); | |
410 } | |
411 | |
401 /* Handle size change of the main render window */ | 412 /* Handle size change of the main render window */ |
402 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data) | 413 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data) |
403 { | 414 { |
404 HPIXMAP old1 = text1pm, old2 = text2pm; | 415 HPIXMAP old1 = text1pm, old2 = text2pm; |
405 int depth = dw_color_depth_get(); | 416 int depth = dw_color_depth_get(); |
528 sprintf(buf,"DW_SIGNAL_COLUMN_CLICK: Window: %x Column: %d Type: %s Itemdata: %x", (unsigned int)window, column_num, buf1, (unsigned int)data ); | 539 sprintf(buf,"DW_SIGNAL_COLUMN_CLICK: Window: %x Column: %d Type: %s Itemdata: %x", (unsigned int)window, column_num, buf1, (unsigned int)data ); |
529 dw_window_set_text( statline, buf); | 540 dw_window_set_text( statline, buf); |
530 return 0; | 541 return 0; |
531 } | 542 } |
532 | 543 |
544 int DWSIGNAL combobox_select_event_callback(HWND window, int index) | |
545 { | |
546 fprintf(stderr,"got combobox_select_event for index: %d, iteration: %d\n", index, iteration++); | |
547 return FALSE; | |
548 } | |
549 | |
533 void archive_add(void) | 550 void archive_add(void) |
534 { | 551 { |
535 HWND browsebutton, browsebox; | 552 HWND browsebutton, browsebox; |
536 | 553 |
537 lbbox = dw_box_new(BOXVERT, 10); | 554 lbbox = dw_box_new(BOXVERT, 10); |
771 | 788 |
772 | 789 |
773 void buttons_add(void) | 790 void buttons_add(void) |
774 { | 791 { |
775 HWND buttonsbox,abutton1,abutton2,cal,calbox; | 792 HWND buttonsbox,abutton1,abutton2,cal,calbox; |
793 int i; | |
794 char buf[20]; | |
795 char **text; | |
776 | 796 |
777 /* create a box to pack into the notebook page */ | 797 /* create a box to pack into the notebook page */ |
778 buttonsbox = dw_box_new(BOXVERT, 2); | 798 buttonsbox = dw_box_new(BOXVERT, 2); |
779 dw_box_pack_start( notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0); | 799 dw_box_pack_start( notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0); |
780 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED); | 800 dw_window_set_color(buttonsbox, DW_CLR_RED, DW_CLR_RED); |
797 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, FOLDER_ICON_NAME ); | 817 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, FOLDER_ICON_NAME ); |
798 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 ); | 818 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 ); |
799 dw_signal_connect( abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); | 819 dw_signal_connect( abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); |
800 | 820 |
801 create_button(0); | 821 create_button(0); |
822 /* make a combobox */ | |
823 combox = dw_box_new(BOXVERT, 2); | |
824 dw_box_pack_start( notebookbox5, combox, 25, 200, TRUE, TRUE, 0); | |
825 combobox1 = dw_combobox_new( "fred", 0 ); /* no point in specifying an initial value */ | |
826 dw_box_pack_start( combox, combobox1, 200, 20, TRUE, FALSE, 0); | |
827 /* | |
828 dw_window_set_text( combobox, "initial value"); | |
829 */ | |
830 dw_signal_connect( combobox1, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL ); | |
831 #if 0 | |
832 /* add LOTS of items */ | |
833 fprintf(stderr,"before appending 100 items to combobox using dw_listbox_append()\n"); | |
834 for( i = 0; i < 100; i++ ) | |
835 { | |
836 sprintf( buf, "item %d", i); | |
837 dw_listbox_append( combobox1, buf ); | |
838 } | |
839 fprintf(stderr,"after appending 100 items to combobox\n"); | |
840 #endif | |
841 | |
842 combobox2 = dw_combobox_new( "joe", 0 ); /* no point in specifying an initial value */ | |
843 dw_box_pack_start( combox, combobox2, 200, 20, TRUE, FALSE, 0); | |
844 /* | |
845 dw_window_set_text( combobox, "initial value"); | |
846 */ | |
847 dw_signal_connect( combobox2, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(combobox_select_event_callback), NULL ); | |
848 /* add LOTS of items */ | |
849 fprintf(stderr,"before appending 500 items to combobox using dw_listbox_list_append()\n"); | |
850 text = (char **)malloc(500*sizeof(char *)); | |
851 for( i = 0; i < 500; i++ ) | |
852 { | |
853 text[i] = (char *)malloc( 50 ); | |
854 sprintf( text[i], "item %d", i); | |
855 } | |
856 dw_listbox_list_append( combobox2, text, 500 ); | |
857 fprintf(stderr,"after appending 500 items to combobox\n"); | |
858 for( i = 0; i < 500; i++ ) | |
859 { | |
860 free(text[i]); | |
861 } | |
862 free(text); | |
863 /* make a spinbutton */ | |
864 spinbutton = dw_spinbutton_new( "", 0 ); /* no point in specifying text */ | |
865 dw_box_pack_start( combox, spinbutton, 200, 20, TRUE, FALSE, 0); | |
866 dw_spinbutton_set_limits( spinbutton, 100, 1 ); | |
867 dw_spinbutton_set_pos( spinbutton, 30 ); | |
868 dw_signal_connect( spinbutton, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(spinbutton_valuechanged), NULL ); | |
802 } | 869 } |
803 | 870 |
804 void create_button( int redraw) | 871 void create_button( int redraw) |
805 { | 872 { |
806 HWND abutton1; | 873 HWND abutton1; |
854 dw_box_pack_start(mdi2w, mdi2box, 0, 0, TRUE, TRUE, 0); | 921 dw_box_pack_start(mdi2w, mdi2box, 0, 0, TRUE, TRUE, 0); |
855 ef = dw_entryfield_new( "", 0); | 922 ef = dw_entryfield_new( "", 0); |
856 dw_box_pack_start(mdi2box, ef, 150, 30, FALSE, FALSE, 4); | 923 dw_box_pack_start(mdi2box, ef, 150, 30, FALSE, FALSE, 4); |
857 bb = dw_button_new("Browse", 0); | 924 bb = dw_button_new("Browse", 0); |
858 dw_box_pack_start(mdi2box, bb, 60, 30, FALSE, FALSE, 4); | 925 dw_box_pack_start(mdi2box, bb, 60, 30, FALSE, FALSE, 4); |
859 dw_window_set_size(mdi2w, 200, 100); | 926 dw_window_set_size(mdi2w, 200, 200); |
860 dw_window_show(mdi2w); | 927 dw_window_show(mdi2w); |
861 dw_window_set_pos(mdi2w, 200, 200); | |
862 } | 928 } |
863 | 929 |
864 /* | 930 /* |
865 * Let's demonstrate the functionality of this library. :) | 931 * Let's demonstrate the functionality of this library. :) |
866 */ | 932 */ |