comparison os2/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 e78027768548
comparison
equal deleted inserted replaced
150:2a0d7b57a6da 151:656de0c52c56
7325 testok2, 7325 testok2,
7326 testcancel2, 7326 testcancel2,
7327 notebook; 7327 notebook;
7328 int count = 2; 7328 int count = 2;
7329 7329
7330 #ifdef USE_FILTER
7331 /* Do any handling you need in the filter function */
7332 LONG testfilter(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
7333 {
7334 switch(msg)
7335 {
7336 case WM_COMMAND:
7337 switch (COMMANDMSG(&msg)->cmd)
7338 {
7339 case 1001L:
7340 case 1002L:
7341 dw_window_destroy(mainwindow);;
7342 count--;
7343 break;
7344 case 1003L:
7345 case 1004L:
7346 dw_window_destroy(testwindow);;
7347 count--;
7348 break;
7349 }
7350 if(!count)
7351 exit(0);
7352 break;
7353 }
7354 /* Return -1 to allow the default handlers to return. */
7355 return TRUE;
7356 }
7357 #else
7358 int test_callback(HWND window, void *data) 7330 int test_callback(HWND window, void *data)
7359 { 7331 {
7360 dw_window_destroy((HWND)data); 7332 dw_window_destroy((HWND)data);
7361 /* Return -1 to allow the default handlers to return. */ 7333 /* Return -1 to allow the default handlers to return. */
7362 count--; 7334 count--;
7363 if(!count) 7335 if(!count)
7364 exit(0); 7336 exit(0);
7365 return -1; 7337 return -1;
7366 } 7338 }
7367 #endif
7368 7339
7369 /* 7340 /*
7370 * Let's demonstrate the functionality of this library. :) 7341 * Let's demonstrate the functionality of this library. :)
7371 */ 7342 */
7372 int main(int argc, char *argv[]) 7343 int main(int argc, char *argv[])
7471 dw_window_set_font(testok2, "9.WarpSans"); 7442 dw_window_set_font(testok2, "9.WarpSans");
7472 dw_window_set_font(testcancel2, "9.WarpSans"); 7443 dw_window_set_font(testcancel2, "9.WarpSans");
7473 7444
7474 dw_window_show(testwindow); 7445 dw_window_show(testwindow);
7475 7446
7476 #ifdef USE_FILTER
7477 dw_main(0L, (void *)testfilter);
7478 #else
7479 /* Setup the function callbacks */ 7447 /* Setup the function callbacks */
7480 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); 7448 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow);
7481 dw_signal_connect(cancelbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); 7449 dw_signal_connect(cancelbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow);
7482 dw_signal_connect(testok, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); 7450 dw_signal_connect(testok, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
7483 dw_signal_connect(testcancel, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); 7451 dw_signal_connect(testcancel, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
7484 dw_signal_connect(testok2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); 7452 dw_signal_connect(testok2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
7485 dw_signal_connect(testcancel2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); 7453 dw_signal_connect(testcancel2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
7486 dw_signal_connect(mainwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); 7454 dw_signal_connect(mainwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow);
7487 dw_signal_connect(testwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); 7455 dw_signal_connect(testwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
7488 7456
7489 dw_main(0L, NULL); 7457 dw_main();
7458
7459 return 0;
7460 }
7490 #endif 7461 #endif
7491
7492 return 0;
7493 }
7494 #endif