Mercurial > dwindows
comparison dwtest.c @ 672:388f2a48aaae
Missed one function to typedef. Fixed errors in the test program and switched to using
the new HICN type after making sure the code built on the other platforms unmodified.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 27 Feb 2011 19:25:21 +0000 |
parents | 9ab89d89e6b4 |
children | 78f9aa6d6d89 |
comparison
equal
deleted
inserted
replaced
671:c60a4f6cfae8 | 672:388f2a48aaae |
---|---|
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 int iteration = 0; |
33 void create_button( int); | 33 void create_button( int); |
34 | |
35 #ifdef __MAC__ | |
36 int main(int argc, char *argv[]) | |
37 { | |
38 DWEnv env; | |
39 HWND window; | |
40 | |
41 dw_init(TRUE, argc, argv); | |
42 | |
43 window = dw_window_new(HWND_DESKTOP, "Test Window", flStyle); | |
44 dw_window_set_pos_size(window, 100, 100, 300, 200); | |
45 dw_window_show(window); | |
46 | |
47 dw_environment_query(&env); | |
48 dw_messagebox("Title", DW_MB_OK | DW_MB_INFORMATION, "Operating System: %s %d.%d\nBuild: %d.%d\n", | |
49 env.osName, env.MajorVersion, env.MinorVersion, env.MajorBuild, env.MinorBuild); | |
50 | |
51 return 0; | |
52 } | |
53 #else | |
54 | 34 |
55 HWND mainwindow, | 35 HWND mainwindow, |
56 entryfield, | 36 entryfield, |
57 checkable_menuitem, | 37 checkable_menuitem, |
58 noncheckable_menuitem, | 38 noncheckable_menuitem, |
105 | 85 |
106 | 86 |
107 int menu_enabled = 1; | 87 int menu_enabled = 1; |
108 | 88 |
109 HPIXMAP text1pm,text2pm; | 89 HPIXMAP text1pm,text2pm; |
110 unsigned long fileicon,foldericon,mle_point=-1; | 90 HICN fileicon,foldericon; |
91 int mle_point=-1; | |
111 | 92 |
112 int font_width = 8; | 93 int font_width = 8; |
113 int font_height=12; | 94 int font_height=12; |
114 int rows=100,width1=6,cols=80; | 95 int rows=100,width1=6,cols=80; |
115 char *current_file = NULL; | 96 char *current_file = NULL; |
210 return keyname; | 191 return keyname; |
211 } | 192 } |
212 | 193 |
213 char *resolve_keymodifiers( int mask ) | 194 char *resolve_keymodifiers( int mask ) |
214 { | 195 { |
215 if ( (mask & KC_CTRL) && (mask & KC_SHIFT) && (mask && KC_ALT) ) | 196 if ( (mask & KC_CTRL) && (mask & KC_SHIFT) && (mask & KC_ALT) ) |
216 return "KC_CTRL KC_SHIFT KC_ALT"; | 197 return "KC_CTRL KC_SHIFT KC_ALT"; |
217 else if ( (mask & KC_CTRL) && (mask & KC_SHIFT) ) | 198 else if ( (mask & KC_CTRL) && (mask & KC_SHIFT) ) |
218 return "KC_CTRL KC_SHIFT"; | 199 return "KC_CTRL KC_SHIFT"; |
219 else if ( (mask & KC_CTRL) && (mask & KC_ALT) ) | 200 else if ( (mask & KC_CTRL) && (mask & KC_ALT) ) |
220 return "KC_CTRL KC_ALT"; | 201 return "KC_CTRL KC_ALT"; |
231 | 212 |
232 /* This gets called when a part of the graph needs to be repainted. */ | 213 /* This gets called when a part of the graph needs to be repainted. */ |
233 int DWSIGNAL text_expose(HWND hwnd, DWExpose *exp, void *data) | 214 int DWSIGNAL text_expose(HWND hwnd, DWExpose *exp, void *data) |
234 { | 215 { |
235 HPIXMAP hpm; | 216 HPIXMAP hpm; |
236 int width,height; | 217 unsigned long width,height; |
237 | 218 |
238 if ( hwnd == textbox1 ) | 219 if ( hwnd == textbox1 ) |
239 hpm = text1pm; | 220 hpm = text1pm; |
240 else if ( hwnd == textbox2 ) | 221 else if ( hwnd == textbox2 ) |
241 hpm = text2pm; | 222 hpm = text2pm; |
243 return TRUE; | 224 return TRUE; |
244 | 225 |
245 width = DW_PIXMAP_WIDTH(hpm); | 226 width = DW_PIXMAP_WIDTH(hpm); |
246 height = DW_PIXMAP_HEIGHT(hpm); | 227 height = DW_PIXMAP_HEIGHT(hpm); |
247 | 228 |
248 dw_pixmap_bitblt(hwnd, NULL, 0, 0, width, height, 0, hpm, 0, 0 ); | 229 dw_pixmap_bitblt(hwnd, NULL, 0, 0, (int)width, (int)height, 0, hpm, 0, 0 ); |
249 dw_flush(); | 230 dw_flush(); |
250 return TRUE; | 231 return TRUE; |
251 } | 232 } |
252 | 233 |
253 void read_file( void ) | 234 void read_file( void ) |
283 char *pLine; | 264 char *pLine; |
284 | 265 |
285 if ( current_file ) | 266 if ( current_file ) |
286 { | 267 { |
287 dw_color_foreground_set(DW_CLR_WHITE); | 268 dw_color_foreground_set(DW_CLR_WHITE); |
288 dw_draw_rect(0, text1pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text1pm), DW_PIXMAP_HEIGHT(text1pm)); | 269 dw_draw_rect(0, text1pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text1pm), (int)DW_PIXMAP_HEIGHT(text1pm)); |
289 dw_draw_rect(0, text2pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text2pm), DW_PIXMAP_HEIGHT(text2pm)); | 270 dw_draw_rect(0, text2pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text2pm), (int)DW_PIXMAP_HEIGHT(text2pm)); |
290 | 271 |
291 for ( i = 0;(i < rows) && (i+row < num_lines); i++) | 272 for ( i = 0;(i < rows) && (i+row < num_lines); i++) |
292 { | 273 { |
293 fileline = i + row - 1; | 274 fileline = i + row - 1; |
294 y = i*font_height; | 275 y = i*font_height; |
508 | 489 |
509 /* Handle size change of the main render window */ | 490 /* Handle size change of the main render window */ |
510 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data) | 491 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data) |
511 { | 492 { |
512 HPIXMAP old1 = text1pm, old2 = text2pm; | 493 HPIXMAP old1 = text1pm, old2 = text2pm; |
513 int depth = dw_color_depth_get(); | 494 unsigned long depth = dw_color_depth_get(); |
514 | 495 |
515 rows = height / font_height; | 496 rows = height / font_height; |
516 cols = width / font_width; | 497 cols = width / font_width; |
517 | 498 |
518 /* Create new pixmaps with the current sizes */ | 499 /* Create new pixmaps with the current sizes */ |
519 text1pm = dw_pixmap_new(textbox1, (font_width*(width1)), height, depth); | 500 text1pm = dw_pixmap_new(textbox1, (unsigned long)(font_width*(width1)), (unsigned long)height, (int)depth); |
520 text2pm = dw_pixmap_new(textbox2, width, height, depth); | 501 text2pm = dw_pixmap_new(textbox2, (unsigned long)width, (unsigned long)height, (int)depth); |
521 | 502 |
522 /* Destroy the old pixmaps */ | 503 /* Destroy the old pixmaps */ |
523 dw_pixmap_destroy(old1); | 504 dw_pixmap_destroy(old1); |
524 dw_pixmap_destroy(old2); | 505 dw_pixmap_destroy(old2); |
525 | 506 |
707 } | 688 } |
708 | 689 |
709 | 690 |
710 void text_add(void) | 691 void text_add(void) |
711 { | 692 { |
712 int depth = dw_color_depth_get(); | 693 unsigned long depth = dw_color_depth_get(); |
713 HWND vscrollbox; | 694 HWND vscrollbox; |
714 | 695 |
715 /* create a box to pack into the notebook page */ | 696 /* create a box to pack into the notebook page */ |
716 pagebox = dw_box_new(BOXHORZ, 2); | 697 pagebox = dw_box_new(BOXHORZ, 2); |
717 dw_box_pack_start( notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0); | 698 dw_box_pack_start( notebookbox2, pagebox, 0, 0, TRUE, TRUE, 0); |
813 DW_CFA_TIME | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, | 794 DW_CFA_TIME | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, |
814 DW_CFA_DATE | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR }; | 795 DW_CFA_DATE | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR }; |
815 int z; | 796 int z; |
816 CTIME time; | 797 CTIME time; |
817 CDATE date; | 798 CDATE date; |
818 unsigned long size, thisicon; | 799 unsigned long size; |
800 HICN thisicon; | |
819 | 801 |
820 /* create a box to pack into the notebook page */ | 802 /* create a box to pack into the notebook page */ |
821 containerbox = dw_box_new(BOXHORZ, 2); | 803 containerbox = dw_box_new(BOXHORZ, 2); |
822 dw_box_pack_start( notebookbox4, containerbox, 500, 200, TRUE, TRUE, 0); | 804 dw_box_pack_start( notebookbox4, containerbox, 500, 200, TRUE, TRUE, 0); |
823 | 805 |
885 } | 867 } |
886 | 868 |
887 | 869 |
888 void buttons_add(void) | 870 void buttons_add(void) |
889 { | 871 { |
890 HWND abutton1,abutton2,calbox,bw; | 872 HWND abutton1,abutton2,calbox; |
891 int i; | 873 int i; |
892 char buf[20]; | |
893 char **text; | 874 char **text; |
894 | 875 |
895 /* create a box to pack into the notebook page */ | 876 /* create a box to pack into the notebook page */ |
896 buttonsbox = dw_box_new(BOXVERT, 2); | 877 buttonsbox = dw_box_new(BOXVERT, 2); |
897 dw_box_pack_start( notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0); | 878 dw_box_pack_start( notebookbox5, buttonsbox, 25, 200, TRUE, TRUE, 0); |
1163 | 1144 |
1164 dw_main(); | 1145 dw_main(); |
1165 | 1146 |
1166 return 0; | 1147 return 0; |
1167 } | 1148 } |
1168 #endif |