Mercurial > dwindows
comparison dwtest.c @ 774:bf3e9892146f
Add new notebook page to test scrollbox widget
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 19 Mar 2011 01:21:04 +0000 |
parents | 0a364e76a7aa |
children | 37cdfec6d3fa |
comparison
equal
deleted
inserted
replaced
773:d57561c34c3a | 774:bf3e9892146f |
---|---|
25 #define FOLDER_ICON_NAME "gtk/folder" | 25 #define FOLDER_ICON_NAME "gtk/folder" |
26 #define FILE_ICON_NAME "gtk/file" | 26 #define FILE_ICON_NAME "gtk/file" |
27 #endif | 27 #endif |
28 | 28 |
29 #define SCROLLBARWIDTH 14 | 29 #define SCROLLBARWIDTH 14 |
30 #define MAX_WIDGETS 20 | |
30 | 31 |
31 unsigned long flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR | | 32 unsigned long flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR | |
32 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER; | 33 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER; |
33 | 34 |
34 unsigned long current_color = DW_RGB(100,100,100); | 35 unsigned long current_color = DW_RGB(100,100,100); |
35 | 36 |
36 int iteration = 0; | 37 int iteration = 0; |
37 void create_button( int); | 38 void create_button( int); |
38 | 39 |
39 HWND mainwindow, | 40 HWND mainwindow, |
40 entryfield, | 41 entryfield, |
41 checkable_menuitem, | 42 checkable_menuitem, |
42 noncheckable_menuitem, | 43 noncheckable_menuitem, |
56 notebookbox3, | 57 notebookbox3, |
57 notebookbox4, | 58 notebookbox4, |
58 notebookbox5, | 59 notebookbox5, |
59 notebookbox6, | 60 notebookbox6, |
60 notebookbox7, | 61 notebookbox7, |
62 notebookbox8, | |
61 html, | 63 html, |
62 rawhtml, | 64 rawhtml, |
63 notebook, | 65 notebook, |
64 vscrollbar, | 66 vscrollbar, |
65 hscrollbar, | 67 hscrollbar, |
77 gap_box, | 79 gap_box, |
78 buttonbox, | 80 buttonbox, |
79 buttonsbox, | 81 buttonsbox, |
80 buttonboxperm, | 82 buttonboxperm, |
81 cal, | 83 cal, |
84 scrollbox, | |
85 labelarray[MAX_WIDGETS], | |
86 entryarray[MAX_WIDGETS], | |
82 filetoolbarbox; | 87 filetoolbarbox; |
83 | 88 |
84 HMENUI mainmenubar,changeable_menu; | 89 HMENUI mainmenubar,changeable_menu; |
85 #define CHECKABLE_MENUITEMID 2001 | 90 #define CHECKABLE_MENUITEMID 2001 |
86 #define NONCHECKABLE_MENUITEMID 2002 | 91 #define NONCHECKABLE_MENUITEMID 2002 |
225 else if ( hwnd == textbox2 ) | 230 else if ( hwnd == textbox2 ) |
226 hpm = text2pm; | 231 hpm = text2pm; |
227 else | 232 else |
228 return TRUE; | 233 return TRUE; |
229 | 234 |
230 width = DW_PIXMAP_WIDTH(hpm); | 235 width = (int)DW_PIXMAP_WIDTH(hpm); |
231 height = DW_PIXMAP_HEIGHT(hpm); | 236 height = (int)DW_PIXMAP_HEIGHT(hpm); |
232 | 237 |
233 dw_pixmap_bitblt(hwnd, NULL, 0, 0, (int)width, (int)height, 0, hpm, 0, 0 ); | 238 dw_pixmap_bitblt(hwnd, NULL, 0, 0, (int)width, (int)height, 0, hpm, 0, 0 ); |
234 dw_flush(); | 239 dw_flush(); |
235 return TRUE; | 240 return TRUE; |
236 } | 241 } |
1057 * Add the "Help" menu to the menubar... | 1062 * Add the "Help" menu to the menubar... |
1058 */ | 1063 */ |
1059 dw_menu_append_item( mainmenubar, "~Help", 1090, 0, TRUE, FALSE, menu ); | 1064 dw_menu_append_item( mainmenubar, "~Help", 1090, 0, TRUE, FALSE, menu ); |
1060 } | 1065 } |
1061 | 1066 |
1067 int DWSIGNAL scrollbox_button_callback(HWND window, void *data) | |
1068 { | |
1069 int pos, range; | |
1070 | |
1071 pos = dw_scrollbox_get_pos( scrollbox, DW_VERT ); | |
1072 range = dw_scrollbox_get_range( scrollbox, DW_VERT ); | |
1073 fprintf( stderr, "Pos %d Range %d\n", pos, range ); | |
1074 return 0; | |
1075 } | |
1076 | |
1077 void scrollbox_add(void) | |
1078 { | |
1079 HWND tmpbox,abutton1; | |
1080 char buf[100]; | |
1081 int i; | |
1082 | |
1083 /* create a box to pack into the notebook page */ | |
1084 scrollbox = dw_scrollbox_new(DW_VERT, 0); | |
1085 dw_box_pack_start(notebookbox8, scrollbox, 0, 0, TRUE, TRUE, 1); | |
1086 | |
1087 abutton1 = dw_button_new( "Show Adjustments", 0 ); | |
1088 dw_box_pack_start( scrollbox, abutton1, 100, 30, FALSE, FALSE, 0 ); | |
1089 dw_signal_connect( abutton1, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(scrollbox_button_callback), NULL ); | |
1090 | |
1091 for ( i = 0; i < MAX_WIDGETS; i++ ) | |
1092 { | |
1093 tmpbox = dw_box_new( DW_HORZ, 0 ); | |
1094 dw_box_pack_start( scrollbox, tmpbox, 0, 24, TRUE, FALSE, 2); | |
1095 sprintf( buf, "Label %d", i ); | |
1096 labelarray[i] = dw_text_new( buf , 0 ); | |
1097 dw_box_pack_start( tmpbox, labelarray[i], 0, 20, TRUE, FALSE, 0); | |
1098 sprintf( buf, "Entry %d", i ); | |
1099 entryarray[i] = dw_entryfield_new( buf , i ); | |
1100 dw_box_pack_start( tmpbox, entryarray[i], 0, 20, TRUE, FALSE, 0); | |
1101 } | |
1102 } | |
1103 | |
1062 /* | 1104 /* |
1063 * Let's demonstrate the functionality of this library. :) | 1105 * Let's demonstrate the functionality of this library. :) |
1064 */ | 1106 */ |
1065 int main(int argc, char *argv[]) | 1107 int main(int argc, char *argv[]) |
1066 { | 1108 { |
1069 ULONG notebookpage3; | 1111 ULONG notebookpage3; |
1070 ULONG notebookpage4; | 1112 ULONG notebookpage4; |
1071 ULONG notebookpage5; | 1113 ULONG notebookpage5; |
1072 ULONG notebookpage6; | 1114 ULONG notebookpage6; |
1073 ULONG notebookpage7; | 1115 ULONG notebookpage7; |
1116 ULONG notebookpage8; | |
1074 | 1117 |
1075 dw_init(TRUE, argc, argv); | 1118 dw_init(TRUE, argc, argv); |
1076 | 1119 |
1077 mainwindow = dw_window_new( HWND_DESKTOP, "dwindows test", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); | 1120 mainwindow = dw_window_new( HWND_DESKTOP, "dwindows test", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); |
1078 dw_window_set_icon(mainwindow, fileicon); | 1121 dw_window_set_icon(mainwindow, fileicon); |
1139 * but as the base file is XML, the Windows browser instance can't display it. | 1182 * but as the base file is XML, the Windows browser instance can't display it. |
1140 * Instead a pure HTML based web page is displayed. MHES 5/4/2008 | 1183 * Instead a pure HTML based web page is displayed. MHES 5/4/2008 |
1141 */ | 1184 */ |
1142 dw_html_url(html, "http://www.rexx.org"); | 1185 dw_html_url(html, "http://www.rexx.org"); |
1143 #endif | 1186 #endif |
1187 | |
1188 notebookbox8 = dw_box_new( BOXVERT, 7 ); | |
1189 notebookpage8 = dw_notebook_page_new( notebook, 1, FALSE ); | |
1190 dw_notebook_pack( notebook, notebookpage8, notebookbox8 ); | |
1191 dw_notebook_page_set_text( notebook, notebookpage8, "scrollbox"); | |
1192 scrollbox_add(); | |
1193 | |
1144 dw_signal_connect(mainwindow, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); | 1194 dw_signal_connect(mainwindow, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(exit_callback), (void *)mainwindow); |
1145 timerid = dw_timer_connect(2000, DW_SIGNAL_FUNC(timer_callback), 0); | 1195 timerid = dw_timer_connect(2000, DW_SIGNAL_FUNC(timer_callback), 0); |
1146 dw_window_set_size(mainwindow, 640, 520); | 1196 dw_window_set_size(mainwindow, 640, 520); |
1147 dw_window_show(mainwindow); | 1197 dw_window_show(mainwindow); |
1148 | 1198 |