Mercurial > dwindows
comparison win/dw.c @ 151:656de0c52c56
Removed the filter from the test program and updated dw_main().
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 26 Oct 2002 21:33:31 +0000 |
parents | 2a0d7b57a6da |
children | a371875d5486 |
comparison
equal
deleted
inserted
replaced
150:2a0d7b57a6da | 151:656de0c52c56 |
---|---|
7203 testok2, | 7203 testok2, |
7204 testcancel2, | 7204 testcancel2, |
7205 notebook; | 7205 notebook; |
7206 int count = 2; | 7206 int count = 2; |
7207 | 7207 |
7208 #ifdef USE_FILTER | |
7209 /* Do any handling you need in the filter function */ | |
7210 LONG testfilter(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
7211 { | |
7212 switch(msg) | |
7213 { | |
7214 case WM_COMMAND: | |
7215 switch (COMMANDMSG(&msg)->cmd) | |
7216 { | |
7217 case 1001L: | |
7218 case 1002L: | |
7219 dw_window_destroy(mainwindow);; | |
7220 count--; | |
7221 break; | |
7222 case 1003L: | |
7223 case 1004L: | |
7224 dw_window_destroy(testwindow);; | |
7225 count--; | |
7226 break; | |
7227 } | |
7228 if(!count) | |
7229 exit(0); | |
7230 break; | |
7231 } | |
7232 /* Return -1 to allow the default handlers to return. */ | |
7233 return TRUE; | |
7234 } | |
7235 #else | |
7236 int test_callback(HWND window, void *data) | 7208 int test_callback(HWND window, void *data) |
7237 { | 7209 { |
7238 dw_window_destroy((HWND)data); | 7210 dw_window_destroy((HWND)data); |
7239 /* Return -1 to allow the default handlers to return. */ | 7211 /* Return -1 to allow the default handlers to return. */ |
7240 count--; | 7212 count--; |
7241 if(!count) | 7213 if(!count) |
7242 exit(0); | 7214 exit(0); |
7243 return -1; | 7215 return -1; |
7244 } | 7216 } |
7245 #endif | |
7246 | 7217 |
7247 /* | 7218 /* |
7248 * Let's demonstrate the functionality of this library. :) | 7219 * Let's demonstrate the functionality of this library. :) |
7249 */ | 7220 */ |
7250 int main(int argc, char *argv[]) | 7221 int main(int argc, char *argv[]) |
7349 dw_window_set_font(testok2, "9.WarpSans"); | 7320 dw_window_set_font(testok2, "9.WarpSans"); |
7350 dw_window_set_font(testcancel2, "9.WarpSans"); | 7321 dw_window_set_font(testcancel2, "9.WarpSans"); |
7351 | 7322 |
7352 dw_window_show(testwindow); | 7323 dw_window_show(testwindow); |
7353 | 7324 |
7354 #ifdef USE_FILTER | |
7355 | |
7356 dw_main(0L, (void *)testfilter); | |
7357 #else | |
7358 /* Setup the function callbacks */ | 7325 /* Setup the function callbacks */ |
7359 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | 7326 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); |
7360 dw_signal_connect(cancelbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | 7327 dw_signal_connect(cancelbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); |
7361 dw_signal_connect(testok, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | 7328 dw_signal_connect(testok, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); |
7362 dw_signal_connect(testcancel, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | 7329 dw_signal_connect(testcancel, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); |
7363 dw_signal_connect(testok2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | 7330 dw_signal_connect(testok2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); |
7364 dw_signal_connect(testcancel2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | 7331 dw_signal_connect(testcancel2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); |
7365 dw_signal_connect(mainwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | 7332 dw_signal_connect(mainwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); |
7366 dw_signal_connect(testwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | 7333 dw_signal_connect(testwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); |
7367 | 7334 |
7368 dw_main(0L, NULL); | 7335 dw_main(); |
7336 | |
7337 return 0; | |
7338 } | |
7369 #endif | 7339 #endif |
7370 | |
7371 return 0; | |
7372 } | |
7373 #endif |