Mercurial > dwindows
comparison dwtest.c @ 566:f6de197ecbe9
Add dw_color_choose()
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 17 Jun 2004 11:22:14 +0000 |
parents | 79696a852401 |
children | 81ca08481d49 |
comparison
equal
deleted
inserted
replaced
565:355a6d46adb1 | 566:f6de197ecbe9 |
---|---|
25 #define SCROLLBARWIDTH 14 | 25 #define SCROLLBARWIDTH 14 |
26 | 26 |
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_CLR_GREEN; | |
31 | |
30 void create_button( int); | 32 void create_button( int); |
31 | 33 |
32 #ifdef __MAC__ | 34 #ifdef __MAC__ |
33 int main(int argc, char *argv[]) | 35 int main(int argc, char *argv[]) |
34 { | 36 { |
50 #else | 52 #else |
51 | 53 |
52 HWND mainwindow, | 54 HWND mainwindow, |
53 entryfield, | 55 entryfield, |
54 cursortogglebutton, | 56 cursortogglebutton, |
57 colorchoosebutton, | |
55 okbutton, | 58 okbutton, |
56 cancelbutton, | 59 cancelbutton, |
57 lbbox, | 60 lbbox, |
58 notebookbox, | 61 notebookbox, |
59 notebookbox1, | 62 notebookbox1, |
279 text_expose( textbox1, NULL, NULL); | 282 text_expose( textbox1, NULL, NULL); |
280 text_expose( textbox2, NULL, NULL); | 283 text_expose( textbox2, NULL, NULL); |
281 } | 284 } |
282 } | 285 } |
283 | 286 |
287 | |
288 int DWSIGNAL colorchoose_callback(HWND window, void *data) | |
289 { | |
290 current_color = dw_color_choose(current_color); | |
291 return FALSE; | |
292 } | |
293 | |
284 int DWSIGNAL cursortoggle_callback(HWND window, void *data) | 294 int DWSIGNAL cursortoggle_callback(HWND window, void *data) |
285 { | 295 { |
296 | |
286 if(cursor_arrow) | 297 if(cursor_arrow) |
287 { | 298 { |
288 dw_window_set_text((HWND)cursortogglebutton,"Set Cursor pointer - ARROW"); | 299 dw_window_set_text((HWND)cursortogglebutton,"Set Cursor pointer - ARROW"); |
289 dw_window_set_pointer((HWND)data,DW_POINTER_CLOCK); | 300 dw_window_set_pointer((HWND)data,DW_POINTER_CLOCK); |
290 cursor_arrow = 0; | 301 cursor_arrow = 0; |
554 buttonbox = dw_box_new(BOXHORZ, 10); | 565 buttonbox = dw_box_new(BOXHORZ, 10); |
555 | 566 |
556 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); | 567 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); |
557 | 568 |
558 cursortogglebutton = dw_button_new("Set Cursor pointer - CLOCK", 1003L); | 569 cursortogglebutton = dw_button_new("Set Cursor pointer - CLOCK", 1003L); |
559 | |
560 dw_box_pack_start(buttonbox, cursortogglebutton, 130, 30, TRUE, TRUE, 2); | 570 dw_box_pack_start(buttonbox, cursortogglebutton, 130, 30, TRUE, TRUE, 2); |
561 | 571 |
572 colorchoosebutton = dw_button_new("Color Chooser Dialog", 1004L); | |
573 dw_box_pack_start(buttonbox, colorchoosebutton, 130, 30, TRUE, TRUE, 2); | |
574 | |
562 okbutton = dw_button_new("Turn Off Annoying Beep!", 1001L); | 575 okbutton = dw_button_new("Turn Off Annoying Beep!", 1001L); |
563 | |
564 dw_box_pack_start(buttonbox, okbutton, 130, 30, TRUE, TRUE, 2); | 576 dw_box_pack_start(buttonbox, okbutton, 130, 30, TRUE, TRUE, 2); |
565 | 577 |
566 cancelbutton = dw_button_new("Exit", 1002L); | 578 cancelbutton = dw_button_new("Exit", 1002L); |
567 | |
568 dw_box_pack_start(buttonbox, cancelbutton, 130, 30, TRUE, TRUE, 2); | 579 dw_box_pack_start(buttonbox, cancelbutton, 130, 30, TRUE, TRUE, 2); |
569 | 580 |
570 /* Set some nice fonts and colors */ | 581 /* Set some nice fonts and colors */ |
571 dw_window_set_color(lbbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); | 582 dw_window_set_color(lbbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); |
572 dw_window_set_color(buttonbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); | 583 dw_window_set_color(buttonbox, DW_CLR_DARKCYAN, DW_CLR_PALEGRAY); |
574 | 585 |
575 dw_signal_connect(browsebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(browse_callback), (void *)notebookbox1); | 586 dw_signal_connect(browsebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(browse_callback), (void *)notebookbox1); |
576 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(beep_callback), (void *)notebookbox1); | 587 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(beep_callback), (void *)notebookbox1); |
577 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); | 588 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); |
578 dw_signal_connect(cursortogglebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(cursortoggle_callback), (void *)mainwindow); | 589 dw_signal_connect(cursortogglebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(cursortoggle_callback), (void *)mainwindow); |
590 dw_signal_connect(colorchoosebutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(colorchoose_callback), (void *)mainwindow); | |
579 } | 591 } |
580 | 592 |
581 | 593 |
582 void text_add(void) | 594 void text_add(void) |
583 { | 595 { |
769 * Create our file toolbar boxes... | 781 * Create our file toolbar boxes... |
770 */ | 782 */ |
771 buttonboxperm = dw_box_new( BOXVERT, 0 ); | 783 buttonboxperm = dw_box_new( BOXVERT, 0 ); |
772 dw_box_pack_start( buttonsbox, buttonboxperm, 25, 0, FALSE, TRUE, 2 ); | 784 dw_box_pack_start( buttonsbox, buttonboxperm, 25, 0, FALSE, TRUE, 2 ); |
773 dw_window_set_color(buttonboxperm, DW_CLR_WHITE, DW_CLR_WHITE); | 785 dw_window_set_color(buttonboxperm, DW_CLR_WHITE, DW_CLR_WHITE); |
774 abutton1 = dw_bitmapbutton_new_from_file( "Top", 0, "junk" ); | 786 abutton1 = dw_bitmapbutton_new_from_file( "Top", 0, FILE_ICON_NAME ); |
775 dw_box_pack_start( buttonboxperm, abutton1, 25, 25, FALSE, FALSE, 0 ); | 787 dw_box_pack_start( buttonboxperm, abutton1, 25, 25, FALSE, FALSE, 0 ); |
776 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); | 788 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); |
777 dw_box_pack_start( buttonboxperm, 0, 25, 5, FALSE, FALSE, 0 ); | 789 dw_box_pack_start( buttonboxperm, 0, 25, 5, FALSE, FALSE, 0 ); |
778 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, "junk" ); | 790 abutton2 = dw_bitmapbutton_new_from_file( "Bottom", 0, FOLDER_ICON_NAME ); |
779 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 ); | 791 dw_box_pack_start( buttonsbox, abutton2, 25, 25, FALSE, FALSE, 0 ); |
780 dw_signal_connect( abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); | 792 dw_signal_connect( abutton2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(button_callback), NULL ); |
781 | 793 |
782 create_button(0); | 794 create_button(0); |
783 } | 795 } |