comparison dwtest.c @ 192:d946e329670c

Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2 style colors not just RGB.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 17 Jan 2003 23:28:28 +0000
parents 634625c3239d
children efd4703450fa
comparison
equal deleted inserted replaced
191:634625c3239d 192:d946e329670c
22 stext, 22 stext,
23 pagebox, 23 pagebox,
24 textbox1, textbox2, 24 textbox1, textbox2,
25 buttonbox; 25 buttonbox;
26 26
27 int exit_callback(HWND window, void *data) 27 int DWSIGNAL exit_callback(HWND window, void *data)
28 { 28 {
29 dw_window_destroy((HWND)data); 29 dw_window_destroy((HWND)data);
30 exit(0); 30 exit(0);
31 return -1; 31 return -1;
32 } 32 }
33 33
34 int test_callback(HWND window, void *data) 34 int DWSIGNAL test_callback(HWND window, void *data)
35 { 35 {
36 dw_window_destroy((HWND)data); 36 dw_window_destroy((HWND)data);
37 exit(0); 37 exit(0);
38 return -1; 38 return -1;
39 } 39 }
40 int browse_callback(HWND window, void *data) 40
41 int DWSIGNAL browse_callback(HWND window, void *data)
41 { 42 {
42 dw_file_browse("test string", NULL, "c", DW_FILE_OPEN ); 43 dw_file_browse("test string", NULL, "c", DW_FILE_OPEN );
43 return 0; 44 return 0;
44 } 45 }
45 46
135 int font_width = 9; 136 int font_width = 9;
136 int font_height=6; 137 int font_height=6;
137 int rows=100,width1=6,width2=50; 138 int rows=100,width1=6,width2=50;
138 139
139 /* This gets called when a part of the graph needs to be repainted. */ 140 /* This gets called when a part of the graph needs to be repainted. */
140 int text_expose(HWND hwnd, DWExpose *exp, void *data) 141 int DWSIGNAL text_expose(HWND hwnd, DWExpose *exp, void *data)
141 { 142 {
142 HPIXMAP hpm = (HPIXMAP)data; 143 HPIXMAP hpm = (HPIXMAP)data;
143 144
144 dw_pixmap_bitblt(hwnd, NULL, 0, 0, font_width*width1, font_height*rows, NULL, hpm, 0, 0 ); 145 dw_pixmap_bitblt(hwnd, NULL, 0, 0, font_width*width1, font_height*rows, NULL, hpm, 0, 0 );
146 dw_flush();
147 return TRUE;
145 } 148 }
146 149
147 void text_add(void) 150 void text_add(void)
148 { 151 {
149 int i,x,y; 152 int i,x,y;
166 169
167 dw_color_foreground_set(DW_CLR_WHITE); 170 dw_color_foreground_set(DW_CLR_WHITE);
168 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows); 171 dw_draw_rect(0, text1pm, TRUE, 0, 0, font_width*width1, font_height*rows);
169 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*width2, font_height*rows); 172 dw_draw_rect(0, text2pm, TRUE, 0, 0, font_width*width2, font_height*rows);
170 173
171 dw_window_set_font(textbox1, "9.WarpSans");
172 dw_font_text_extents( NULL, text1pm, "O", &font_width, &font_height ); 174 dw_font_text_extents( NULL, text1pm, "O", &font_width, &font_height );
173 dw_messagebox("DWTest", "Width: %d Height: %d\n", font_width, font_height); 175 dw_messagebox("DWTest", "Width: %d Height: %d\n", font_width, font_height);
174 176
175 dw_color_background_set( DW_CLR_WHITE ); 177 dw_color_background_set( DW_CLR_WHITE );
176 for ( i = 0;i < 100; i++) 178 for ( i = 0;i < 100; i++)
182 dw_draw_text( NULL, text1pm, 0, y, buf); 184 dw_draw_text( NULL, text1pm, 0, y, buf);
183 dw_draw_text( NULL, text2pm, 0, y, buf); 185 dw_draw_text( NULL, text2pm, 0, y, buf);
184 } 186 }
185 dw_signal_connect(textbox1, "expose_event", DW_SIGNAL_FUNC(text_expose), text1pm); 187 dw_signal_connect(textbox1, "expose_event", DW_SIGNAL_FUNC(text_expose), text1pm);
186 dw_signal_connect(textbox2, "expose_event", DW_SIGNAL_FUNC(text_expose), text2pm); 188 dw_signal_connect(textbox2, "expose_event", DW_SIGNAL_FUNC(text_expose), text2pm);
187 dw_flush();
188 } 189 }
189 190
190 /* 191 /*
191 * Let's demonstrate the functionality of this library. :) 192 * Let's demonstrate the functionality of this library. :)
192 */ 193 */