comparison dwtest.c @ 1220:67ff39b9577c

Initial implementation of dw_taskbar_* for the Mac. Also added code in the test program to test.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 10 Oct 2011 00:40:22 +0000
parents 22cedf18db25
children 10f5b8645975
comparison
equal deleted inserted replaced
1219:771440316206 1220:67ff39b9577c
505 return 0; 505 return 0;
506 } 506 }
507 507
508 int DWSIGNAL exit_callback(HWND window, void *data) 508 int DWSIGNAL exit_callback(HWND window, void *data)
509 { 509 {
510 dw_taskbar_delete(textbox1, fileicon);
510 dw_window_destroy((HWND)data); 511 dw_window_destroy((HWND)data);
511 exit(0); 512 exit(0);
512 return -1; 513 return -1;
513 } 514 }
514 515
842 int API motion_notify_event(HWND window, int x, int y, int buttonmask, void *data) 843 int API motion_notify_event(HWND window, int x, int y, int buttonmask, void *data)
843 { 844 {
844 char buf[200]; 845 char buf[200];
845 sprintf(buf, "%s: %dx%d", data ? "motion_notify" : "button_press", x, y); 846 sprintf(buf, "%s: %dx%d", data ? "motion_notify" : "button_press", x, y);
846 dw_window_set_text(status2, buf); 847 dw_window_set_text(status2, buf);
848 return 0;
849 }
850
851 int API context_menu_event(HWND window, int x, int y, int buttonmask, void *data)
852 {
853 HMENUI hwndMenu = dw_menu_new(0L);
854 HWND menuitem = dw_menu_append_item(hwndMenu, "~Quit", 1019, 0L, TRUE, FALSE, DW_NOMENU);
855 long px, py;
856
857 dw_signal_connect(menuitem, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow);
858 dw_pointer_query_pos(&px, &py);
859 dw_menu_popup(&hwndMenu, window, (int)px, (int)py);
847 return 0; 860 return 0;
848 } 861 }
849 862
850 void text_add(void) 863 void text_add(void)
851 { 864 {
932 dw_pixmap_set_transparent_color(image, DW_CLR_WHITE); 945 dw_pixmap_set_transparent_color(image, DW_CLR_WHITE);
933 946
934 dw_messagebox("DWTest", DW_MB_OK|DW_MB_INFORMATION, "Width: %d Height: %d\n", font_width, font_height); 947 dw_messagebox("DWTest", DW_MB_OK|DW_MB_INFORMATION, "Width: %d Height: %d\n", font_width, font_height);
935 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows); 948 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows);
936 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*cols, font_height*rows); 949 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*cols, font_height*rows);
950 dw_signal_connect(textbox1, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(context_menu_event), NULL);
937 dw_signal_connect(textbox1, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL); 951 dw_signal_connect(textbox1, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL);
938 dw_signal_connect(textbox2, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL); 952 dw_signal_connect(textbox2, DW_SIGNAL_EXPOSE, DW_SIGNAL_FUNC(text_expose), NULL);
939 dw_signal_connect(textbox2, DW_SIGNAL_CONFIGURE, DW_SIGNAL_FUNC(configure_event), text2pm); 953 dw_signal_connect(textbox2, DW_SIGNAL_CONFIGURE, DW_SIGNAL_FUNC(configure_event), text2pm);
940 dw_signal_connect(textbox2, DW_SIGNAL_MOTION_NOTIFY, DW_SIGNAL_FUNC(motion_notify_event), (void *)1); 954 dw_signal_connect(textbox2, DW_SIGNAL_MOTION_NOTIFY, DW_SIGNAL_FUNC(motion_notify_event), (void *)1);
941 dw_signal_connect(textbox2, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(motion_notify_event), (void *)0); 955 dw_signal_connect(textbox2, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(motion_notify_event), (void *)0);
943 dw_signal_connect(vscrollbar, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(scrollbar_valuechanged_callback), (void *)status1); 957 dw_signal_connect(vscrollbar, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(scrollbar_valuechanged_callback), (void *)status1);
944 dw_signal_connect(button1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(refresh_callback), NULL); 958 dw_signal_connect(button1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(refresh_callback), NULL);
945 dw_signal_connect(button2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(print_callback), NULL); 959 dw_signal_connect(button2, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(print_callback), NULL);
946 dw_signal_connect(rendcombo, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(render_select_event_callback), NULL ); 960 dw_signal_connect(rendcombo, DW_SIGNAL_LIST_SELECT, DW_SIGNAL_FUNC(render_select_event_callback), NULL );
947 dw_signal_connect(mainwindow, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(keypress_callback), NULL); 961 dw_signal_connect(mainwindow, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(keypress_callback), NULL);
962
963 dw_taskbar_insert(textbox1, fileicon, "DWTest");
948 } 964 }
949 965
950 void tree_add(void) 966 void tree_add(void)
951 { 967 {
952 HTREEITEM t1,t2; 968 HTREEITEM t1,t2;
970 dw_box_pack_start( notebookbox3, tree, 500, 200, TRUE, FALSE, 1); 986 dw_box_pack_start( notebookbox3, tree, 500, 200, TRUE, FALSE, 1);
971 987
972 /* and a status area to see whats going on */ 988 /* and a status area to see whats going on */
973 tree_status = dw_status_text_new("", 0); 989 tree_status = dw_status_text_new("", 0);
974 dw_box_pack_start( notebookbox3, tree_status, 100, 20, TRUE, FALSE, 1); 990 dw_box_pack_start( notebookbox3, tree_status, 100, 20, TRUE, FALSE, 1);
975
976 foldericon = dw_icon_load_from_file( FOLDER_ICON_NAME );
977 fileicon = dw_icon_load_from_file( FILE_ICON_NAME );
978 991
979 /* set up our signal trappers... */ 992 /* set up our signal trappers... */
980 dw_signal_connect(tree, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), (void *)tree_status); 993 dw_signal_connect(tree, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), (void *)tree_status);
981 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(item_select_cb), (void *)tree_status); 994 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(item_select_cb), (void *)tree_status);
982 995
1517 mainwindow = dw_window_new( HWND_DESKTOP, "dwindows test", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); 1530 mainwindow = dw_window_new( HWND_DESKTOP, "dwindows test", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX);
1518 dw_window_set_icon(mainwindow, fileicon); 1531 dw_window_set_icon(mainwindow, fileicon);
1519 1532
1520 notebookbox = dw_box_new( BOXVERT, 5 ); 1533 notebookbox = dw_box_new( BOXVERT, 5 );
1521 dw_box_pack_start( mainwindow, notebookbox, 0, 0, TRUE, TRUE, 0); 1534 dw_box_pack_start( mainwindow, notebookbox, 0, 0, TRUE, TRUE, 0);
1535
1536 foldericon = dw_icon_load_from_file( FOLDER_ICON_NAME );
1537 fileicon = dw_icon_load_from_file( FILE_ICON_NAME );
1538
1522 /* MUST pack a box into the mainwindow BEFORE adding menus */ 1539 /* MUST pack a box into the mainwindow BEFORE adding menus */
1523 menu_add(); 1540 menu_add();
1524 1541
1525 notebook = dw_notebook_new( 1, TRUE ); 1542 notebook = dw_notebook_new( 1, TRUE );
1526 dw_box_pack_start( notebookbox, notebook, 100, 100, TRUE, TRUE, 0); 1543 dw_box_pack_start( notebookbox, notebook, 100, 100, TRUE, TRUE, 0);