comparison os2/dw.c @ 14:176cee043f1b

Lots of Windows and Unix bug fixes.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 11 Jul 2001 21:57:56 +0000
parents 26e2130135b9
children 81833f25b1aa
comparison
equal deleted inserted replaced
13:156281539fb3 14:176cee043f1b
84 char name[30]; 84 char name[30];
85 85
86 } SignalList; 86 } SignalList;
87 87
88 /* List of signals and their equivilent OS/2 message */ 88 /* List of signals and their equivilent OS/2 message */
89 #define SIGNALMAX 11 89 #define SIGNALMAX 12
90 90
91 SignalList SignalTranslate[SIGNALMAX] = { 91 SignalList SignalTranslate[SIGNALMAX] = {
92 { WM_SIZE, "configure_event" }, 92 { WM_SIZE, "configure_event" },
93 { WM_CHAR, "key_press_event" }, 93 { WM_CHAR, "key_press_event" },
94 { WM_BUTTON1DOWN, "button_press_event" }, 94 { WM_BUTTON1DOWN, "button_press_event" },
97 { WM_CLOSE, "delete_event" }, 97 { WM_CLOSE, "delete_event" },
98 { WM_PAINT, "expose_event" }, 98 { WM_PAINT, "expose_event" },
99 { WM_COMMAND, "clicked" }, 99 { WM_COMMAND, "clicked" },
100 { CN_ENTER, "container-select" }, 100 { CN_ENTER, "container-select" },
101 { CN_CONTEXTMENU, "container-context" }, 101 { CN_CONTEXTMENU, "container-context" },
102 { LN_SELECT, "item-select" } 102 { LN_SELECT, "item-select" },
103 { WM_SETFOCUS, "set-focus" }
103 }; 104 };
104 105
105 /* This function adds a signal handler callback into the linked list. 106 /* This function adds a signal handler callback into the linked list.
106 */ 107 */
107 void _new_signal(ULONG message, HWND window, void *signalfunction, void *data) 108 void _new_signal(ULONG message, HWND window, void *signalfunction, void *data)
369 /* This function finds the first widget in the 370 /* This function finds the first widget in the
370 * layout and moves the current focus to it. 371 * layout and moves the current focus to it.
371 */ 372 */
372 void _initial_focus(HWND handle) 373 void _initial_focus(HWND handle)
373 { 374 {
374 Box *thisbox; 375 Box *thisbox = NULL;
375 HWND box; 376 HWND box;
376 377
377 box = WinWindowFromID(handle, FID_CLIENT); 378 box = WinWindowFromID(handle, FID_CLIENT);
378 if(box) 379 if(box)
379 thisbox = WinQueryWindowPtr(box, QWP_USER); 380 thisbox = WinQueryWindowPtr(box, QWP_USER);
396 while((box = WinQueryWindow(lastbox, QW_PARENT)) > 0x80000001) 397 while((box = WinQueryWindow(lastbox, QW_PARENT)) > 0x80000001)
397 { 398 {
398 lastbox = box; 399 lastbox = box;
399 } 400 }
400 401
401 thisbox = WinQueryWindowPtr(lastbox, QWP_USER); 402 box = WinWindowFromID(lastbox, FID_CLIENT);
402 if(!thisbox) 403 if(box)
403 { 404 thisbox = WinQueryWindowPtr(box, QWP_USER);
404 box = WinWindowFromID(lastbox, FID_CLIENT); 405 else
405 if(box) 406 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
406 thisbox = WinQueryWindowPtr(box, QWP_USER); 407
407 }
408 if(thisbox) 408 if(thisbox)
409 { 409 {
410 if(_focus_check_box(thisbox, handle, 1) == 0) 410 if(_focus_check_box(thisbox, handle, 1) == 0)
411 _focus_check_box(thisbox, handle, 2); 411 _focus_check_box(thisbox, handle, 2);
412 } 412 }
1160 { 1160 {
1161 if(tmp->message == msg || msg == WM_CONTROL) 1161 if(tmp->message == msg || msg == WM_CONTROL)
1162 { 1162 {
1163 switch(msg) 1163 switch(msg)
1164 { 1164 {
1165 case WM_SETFOCUS:
1166 {
1167 if(mp2)
1168 {
1169 int (*setfocusfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction;
1170
1171 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd)
1172 {
1173 result = setfocusfunc(tmp->window, tmp->data);
1174 tmp = NULL;
1175 }
1176 }
1177 }
1178 break;
1165 case WM_SIZE: 1179 case WM_SIZE:
1166 { 1180 {
1167 int (*sizefunc)(HWND, int, int, void *) = (int (*)(HWND, int, int, void *))tmp->signalfunction; 1181 int (*sizefunc)(HWND, int, int, void *) = (int (*)(HWND, int, int, void *))tmp->signalfunction;
1168 1182
1169 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) 1183 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd)
2100 * Initializes the Dynamic Windows engine. 2114 * Initializes the Dynamic Windows engine.
2101 * Parameters: 2115 * Parameters:
2102 * newthread: True if this is the only thread. 2116 * newthread: True if this is the only thread.
2103 * False if there is already a message loop running. 2117 * False if there is already a message loop running.
2104 */ 2118 */
2105 int dw_init(int newthread) 2119 int dw_init(int newthread, int argc, char *argv[])
2106 { 2120 {
2107 APIRET rc; 2121 APIRET rc;
2108 2122
2109 if(newthread) 2123 if(newthread)
2110 { 2124 {
2283 swcntrl.uchVisibility = SWL_VISIBLE; 2297 swcntrl.uchVisibility = SWL_VISIBLE;
2284 WinChangeSwitchEntry(hswitch, &swcntrl); 2298 WinChangeSwitchEntry(hswitch, &swcntrl);
2285 } 2299 }
2286 return rc; 2300 return rc;
2287 2301
2302 }
2303
2304 /*
2305 * Minimizes or Iconifies a top-level window.
2306 * Parameters:
2307 * handle: The window handle to minimize.
2308 */
2309 int dw_window_minimize(HWND handle)
2310 {
2311 return WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_MINIMIZE);
2288 } 2312 }
2289 2313
2290 /* 2314 /*
2291 * Makes the window invisible. 2315 * Makes the window invisible.
2292 * Parameters: 2316 * Parameters:
2533 2557
2534 WinSetWindowPtr(hwndframe, QWP_USER, newbox); 2558 WinSetWindowPtr(hwndframe, QWP_USER, newbox);
2535 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); 2559 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
2536 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY); 2560 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY);
2537 dw_window_set_font(newbox->grouphwnd, DefaultFont); 2561 dw_window_set_font(newbox->grouphwnd, DefaultFont);
2562 return hwndframe;
2563 }
2564
2565 /*
2566 * Create a new MDI Frame to be packed.
2567 * Parameters:
2568 * id: An ID to be used with dw_window_from_id or 0L.
2569 */
2570 HWND dw_mdi_new(unsigned long id)
2571 {
2572 HWND hwndframe;
2573
2574 hwndframe = WinCreateWindow(HWND_OBJECT,
2575 WC_FRAME,
2576 NULL,
2577 WS_VISIBLE | WS_CLIPCHILDREN,
2578 0,0,2000,1000,
2579 NULLHANDLE,
2580 HWND_TOP,
2581 0L,
2582 NULL,
2583 NULL);
2538 return hwndframe; 2584 return hwndframe;
2539 } 2585 }
2540 2586
2541 /* 2587 /*
2542 * Create a bitmap object to be packed. 2588 * Create a bitmap object to be packed.