void SetBKBrush( gui_window *wnd ) { if (!init_rgb) { InitSystemRGB(); init_rgb = 1; } GUIGetRGB( wnd->colours[GUI_BACKGROUND].back, &wnd->bk_rgb ); wnd->bk_brush = _wpi_createsolidbrush(GUIGetBack( wnd, GUI_BACKGROUND )); }
bool GUIGetWndColour( gui_window *wnd, gui_attr attr, gui_colour_set *colour_set ) { if( colour_set == NULL ) { return( false ); } if( attr < wnd->num_attrs ) { colour_set->fore = GUIGetFore( wnd->colours[attr] ); colour_set->back = GUIGetBack( wnd->colours[attr] ); return( true ); } return( false ); }
void GUIDrawTextBitmapAttr( gui_window *wnd, const char *text, size_t length, int height, gui_coord *pos, gui_attr attr, gui_ord extentx, bool draw_extent, int bitmap ) { WPI_COLOUR fore, back; fore = GUIGetFore( wnd, attr ); back = GUIGetBack( wnd, attr ); GUIDrawTextBitmapRGB( wnd, text, length, height, pos, fore, back, extentx, draw_extent, bitmap ); }
void GUIPaint( gui_window *wnd, HWND hwnd, bool isdlg ) { HDC prev_hdc; PAINTSTRUCT *prev_ps; gui_row_num row_num; PAINTSTRUCT ps; WPI_RECT fill_area; #ifdef __OS2_PM__ ULONG flags; RECTL client; #endif isdlg=isdlg; /* save old state */ prev_hdc = wnd->hdc; prev_ps = wnd->ps; /* Setup Paint */ wnd->ps = &ps; wnd->hdc = _wpi_beginpaint( hwnd, NULLHANDLE, wnd->ps ); _wpi_torgbmode( wnd->hdc ); _wpi_getpaintrect( wnd->ps, &fill_area ); #ifdef __OS2_PM__ fill_area = *(wnd->ps); if( isdlg ) { _wpi_inflaterect( GUIMainHInst, &fill_area, 10, 10); } WinFillRect( wnd->hdc, &fill_area, GUIGetBack( wnd, GUI_BACKGROUND ) ); #endif #if defined( __NT__ ) if( isdlg ) { _wpi_fillrect( wnd->hdc, &fill_area, GUIGetBack( wnd, GUI_BACKGROUND ), wnd->bk_brush ); } #endif if( wnd->font != NULL ) { wnd->prev_font = _wpi_selectfont( wnd->hdc, wnd->font ); } else { wnd->prev_font = NULL; } /* send paint to app */ GUIGetUpdateRows( wnd, hwnd, &row_num.start, &row_num.num ); if( row_num.num > 0 ) { GUIEVENTWND( wnd, GUI_PAINT, &row_num ); } /* finish painting */ if( wnd->prev_font != NULL ) { _wpi_getoldfont( wnd->hdc, wnd->prev_font ); wnd->prev_font = NULL; } #ifdef __OS2_PM__ if( isdlg ) { flags = DB_AREAATTRS | DB_DLGBORDER; #ifdef _M_I86 if( WinQueryActiveWindow( HWND_DESKTOP, FALSE ) != hwnd ) { #else if( WinQueryActiveWindow( HWND_DESKTOP ) != hwnd ) { #endif //if( _wpi_getfocus() != hwnd ) { flags |= DB_PATINVERT; } WinQueryWindowRect( hwnd, &client ); WinDrawBorder( wnd->hdc, &client, 1, 1, 0, 0, flags ); } #endif _wpi_endpaint( hwnd, wnd->hdc, wnd->ps ); /* restore old state */ wnd->hdc = prev_hdc; wnd->ps = prev_ps; } #else // this is some experimental PM stuff void GUIPaint( gui_window *wnd, HWND hwnd, bool isdlg ) { HDC prev_hdc; PAINTSTRUCT *prev_ps; gui_row_num row_num; PAINTSTRUCT ps; PAINTSTRUCT fill_area; // experimenal stuff HPS hps; RECTL client; LONG width, height; ULONG flags; int compat_created; gui_paint_info *pinfo; // figure out which paint info to use if( !isdlg && wnd->root == hwnd ) { pinfo = &wnd->root_pinfo; } else { pinfo = &wnd->hwnd_pinfo; } pinfo->in_use++; compat_created = FALSE; /* save old state */ prev_hdc = wnd->hdc; prev_ps = wnd->ps; if( isdlg ) { _wpi_getclientrect( hwnd, &client ); } else { WinQueryWindowRect( hwnd, &client ); } width = client.xRight - client.xLeft; height = client.yTop - client.yBottom; wnd->ps = &ps; //hps = _wpi_beginpaint( hwnd, pinfo->normal_pres, wnd->ps ); hps = _wpi_beginpaint( hwnd, NULL, wnd->ps ); if( pinfo->compatible_pres == (WPI_PRES)NULL ) { compat_created = TRUE; pinfo->compatible_pres = _wpi_createcompatiblepres( hps, GUIMainHInst, &pinfo->compatible_hdc ); pinfo->draw_bmp = _wpi_createcompatiblebitmap( hps, width, height ); pinfo->old_bmp = _wpi_selectbitmap( pinfo->compatible_pres, pinfo->draw_bmp ); } // the condition is here VERY conservative!! // its gains have to analyzed if( compat_created || pinfo->force_count ) { wnd->hdc = pinfo->compatible_pres; //wnd->hdc = hps; _wpi_torgbmode( wnd->hdc ); fill_area = *(wnd->ps); if( isdlg ) { _wpi_inflaterect( GUIMainHInst, &fill_area, 10, 10); } WinFillRect( wnd->hdc, &fill_area, GUIGetBack( wnd, GUI_BACKGROUND ) ); wnd->prev_font = NULL; if( wnd->font != NULL ) { wnd->prev_font = _wpi_selectfont( wnd->hdc, wnd->font ); } /* send paint to app */ GUIGetUpdateRows( wnd, hwnd, &row_num.start, &row_num.num ); if( row_num.num > 0 ) { GUIEVENTWND( wnd, GUI_PAINT, &row_num ); } /* finish painting */ if( wnd->prev_font != NULL ) { _wpi_getoldfont( wnd->hdc, wnd->prev_font ); wnd->prev_font = NULL; } if( pinfo->force_count ) { //pinfo->force_count--; } } //_wpi_bitblt( hps, client.xLeft, client.yBottom, width, height, // wnd->hdc, 0, 0, SRCCOPY ); if( pinfo->in_use == 1 ) { //_wpi_bitblt( hps, client.xLeft, client.yBottom, width, height, // wnd->hdc, 0, 0, SRCCOPY ); _wpi_bitblt( hps, ps.xLeft, ps.yBottom, ps.xRight - ps.xLeft, ps.yTop - ps.yBottom, wnd->hdc, ps.xLeft, ps.yBottom, SRCCOPY ); if( pinfo->delete_when_done ) { GUIFreePaintHandles( pinfo, TRUE ); } } if( isdlg ) { flags = DB_AREAATTRS | DB_DLGBORDER; #ifdef _M_I86 if( WinQueryActiveWindow( HWND_DESKTOP, FALSE ) != hwnd ) { #else if( WinQueryActiveWindow( HWND_DESKTOP ) != hwnd ) { #endif //if( _wpi_getfocus() != hwnd ) { flags |= DB_PATINVERT; } WinQueryWindowRect( hwnd, &client ); WinDrawBorder( hps, &client, 1, 1, 0, 0, flags ); } _wpi_endpaint( hwnd, hps, wnd->ps ); /* restore old state */ wnd->hdc = prev_hdc; wnd->ps = prev_ps; if( pinfo->in_use ) { pinfo->in_use--; } } #endif void GUIInvalidatePaintHandles( gui_window *wnd ) { GUIFreeWndPaintHandles( wnd, FALSE ); }
WPI_MRESULT CALLBACK GUIWindowProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam ) { gui_window *wnd; gui_window *root; WORD param; WPI_POINT currentpoint; gui_coord point; gui_coord size; WPI_MRESULT ret; WPI_MINMAXINFO _W386FAR *info; WPI_RECT rect; HWND parent; CREATESTRUCT FAR *lpcs; wmcreate_info _W386FAR *wmcreateinfo; gui_create_info *createinfo; bool use_defproc; unsigned control_id; HWND win; #ifndef __OS2_PM__ gui_key_state key_state; RECT rc; #endif root = NULL; ret = 0L; use_defproc = FALSE; if( msg == WM_CREATE ) { lpcs = ( CREATESTRUCT FAR * )MK_FP32( (void *)lparam ); wmcreateinfo = (wmcreate_info _W386FAR *)MK_FP32( _wpi_getcreateparms( lpcs ) ); if ( wmcreateinfo != NULL ) { wnd = wmcreateinfo->wnd; createinfo = wmcreateinfo->info; if( wnd->hwnd == NULLHANDLE ) { #ifdef __OS2_PM__ if( wnd->root_frame != NULLHANDLE && wnd->root == NULLHANDLE ) { wnd->root = hwnd; } else { wnd->hwnd = hwnd; } #else if( _wpi_getparent( hwnd ) == HWND_DESKTOP ) { wnd->root = hwnd; wnd->root_frame = hwnd; } else { wnd->hwnd = hwnd; wnd->hwnd_frame = hwnd; } #endif } DoSetWindowLong( hwnd, wnd ); } } wnd = GUIGetWindow( hwnd ); if( wnd == NULL ) { return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); } if( GUIMDIProcessMessage( wnd, hwnd, msg, wparam, lparam, &ret ) ) { return( ret ); } if( wnd->root == hwnd ) { /* message for root window */ switch( msg ) { case WM_CREATE : #ifdef __OS2_PM__ wnd->root_pinfo.normal_pres = _wpi_createos2normpres( GUIMainHInst, hwnd ); #endif _wpi_getclientrect( wnd->root_frame, &wnd->root_client ); if( CreateBackgroundWnd( wnd, createinfo ) ) { return( 0 ); } return( (WPI_MRESULT)WPI_ERROR_ON_CREATE ); break; case WM_DESTROY : wnd->flags |= DOING_DESTROY; GUICloseToolBar( wnd ); //ret = _wpi_defwindowproc( hwnd, msg, wparam, lparam ); //wnd->root = NULL; //wnd->root_frame = NULL; return( 0L ); } } else if( ( wnd->root != NULLHANDLE ) && ( hwnd == wnd->hwnd ) ) { /* message for container window */ switch( msg ) { case WM_SIZE : if( !_wpi_isiconic( _wpi_getframe( hwnd ) ) ) { size.x = _wpi_getwmsizex( wparam, lparam ); size.y = _wpi_getwmsizey( wparam, lparam ); GUIDoResize( wnd, hwnd, &size ); } return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); break; case WM_MOVE : return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); break; case WM_VSCROLL : case WM_HSCROLL : case WM_CLOSE : return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); break; } } switch( msg ) { case WM_CREATE : #ifdef __OS2_PM__ wnd->hwnd_pinfo.normal_pres = _wpi_createos2normpres( GUIMainHInst, hwnd ); #endif NumWindows++; // even if -1 is returned, window will get WM_DESTROY win = GUIGetParentFrameHWND( wnd ); if( ( wnd->root_frame != NULLHANDLE ) || ( createinfo->style & GUI_POPUP ) ) { if( !GUIAddToSystemMenu( wnd, win, 0, NULL, createinfo->style ) ) { return( (WPI_MRESULT)WPI_ERROR_ON_CREATE ); } } else { if( !GUIAddToSystemMenu( wnd, win, createinfo->num_menus, createinfo->menu, createinfo->style ) ) { return( (WPI_MRESULT)WPI_ERROR_ON_CREATE ); } } _wpi_getclientrect( hwnd, &wnd->hwnd_client ); GUISetRowCol( wnd, NULL ); if( ( hwnd == wnd->hwnd ) && ( wnd->root == NULLHANDLE ) ) { GUIMDINewWindow( hwnd ); } if( GUIEVENTWND( wnd, GUI_INIT_WINDOW, NULL ) ) { wnd->flags |= SENT_INIT; GUISetScroll( wnd ); /* initalize scroll ranges */ GUIBringToFront( wnd ); return( 0 ); } else { /* app decided not to create window */ return( (WPI_MRESULT)WPI_ERROR_ON_CREATE ); } break; #if defined(__NT__) || defined(WILLOWS) case WM_CTLCOLORBTN : case WM_CTLCOLORDLG : //case WM_CTLCOLORLISTBOX : case WM_CTLCOLORSTATIC : //case WM_CTLCOLOREDIT : ret = (WPI_MRESULT)GUICtl3dCtlColorEx( msg, wparam, lparam ); if( ret == (HBRUSH)NULL ) { SetBkColor( (HDC)wparam, GetNearestColor( (HDC)wparam, GUIGetBack( wnd, GUI_BACKGROUND ) ) ); ret = (WPI_MRESULT)wnd->bk_brush; } return( ret ); #elif !defined( __OS2_PM__ ) case WM_CTLCOLOR : switch( HIWORD( lparam ) ) { case CTLCOLOR_BTN : case CTLCOLOR_DLG : case CTLCOLOR_EDIT : case CTLCOLOR_LISTBOX : case CTLCOLOR_MSGBOX : case CTLCOLOR_STATIC : ret = (WPI_MRESULT)GUICtl3dCtlColorEx( msg, wparam, lparam ); if( ret == (HBRUSH)NULL ) { SetBkColor( (HDC)wparam, GetNearestColor( (HDC)wparam, GUIGetBack( wnd, GUI_BACKGROUND ) ) ); ret = (WPI_MRESULT)wnd->bk_brush; } break; } return( ret ); #endif #ifndef __OS2_PM__ case WM_INITMENUPOPUP : return( GUIProcessInitMenuPopup( wnd, hwnd, msg, wparam, lparam ) ); case WM_MENUSELECT : return( GUIProcessMenuSelect( wnd, hwnd, msg, wparam, lparam ) ); #endif case WM_GETMINMAXINFO : info = (WPI_MINMAXINFO _W386FAR *)MK_FP32( (void *)lparam ); ret = _wpi_defwindowproc( hwnd, msg, wparam, lparam ); if( wnd->root == NULLHANDLE ) { parent = _wpi_getparent( hwnd ); _wpi_getclientrect( parent, &rect ); _wpi_setmaxposition( *info, 0, 0 ); _wpi_setmaxtracksize( info, _wpi_getwidthrect( rect ), _wpi_getheightrect( rect ) ); } return( ret ); case WM_ERASEBKGND: #ifdef __OS2_PM__ //GUIInvalidatePaintHandles( wnd ); return( (WPI_MRESULT)TRUE ); #else if( !_wpi_isiconic( hwnd ) ) { GetClientRect( hwnd, &rc ); FillRect( (HDC)wparam, &rc, wnd->bk_brush ); } use_defproc = TRUE; break; #endif #if !defined(__OS2_PM__) && !defined(WILLOWS) case WM_PAINTICON : { HICON old; old = SET_HICON( wnd->hwnd, wnd->icon ); ret = _wpi_defwindowproc( hwnd, msg, wparam, lparam ); SET_HICON( wnd->hwnd, old ); return( ret ); } #endif case WM_PAINT: if( _wpi_isiconic( hwnd ) ) { return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); } else { GUIPaint( wnd, hwnd, FALSE ); } break; #ifndef __OS2_PM__ case WM_ACTIVATEAPP : root = GUIGetRootWindow(); ActivateNC( root, wparam ); if( GUICurrWnd != NULL ) { ActivateNC( GUICurrWnd, wparam ); } use_defproc = (bool)wparam; // I'm cheating and using 'use_defproc' // outside of its self-documented purpose if( root ) GUIEVENTWND( root, GUI_ACTIVATEAPP, &use_defproc ); use_defproc = TRUE; break; #if 0 // this repaints the nc client area when the window loses focus to // a window that is not a descendant of a GUI window case WM_KILLFOCUS : if( !GUIIsGUIChild( (HWND)wparam ) ) { ActivateNC( wnd, FALSE ); } break; #endif case WM_SETFOCUS : if( !_wpi_ismsgsetfocus( msg, lparam ) ) { return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); } if( !EditControlHasFocus ) { if( SetFocusToParent() ) { return( 0L ); } } break; #endif case WM_VSCROLL : case WM_HSCROLL : GUIProcessScrollMsg( wnd, msg, wparam, lparam ); return( 0L ); #ifdef __NT__ case WM_MOUSEWHEEL : { // Try to handle mousewheel messages... // Fake them into GUIProcessScrollMsg() // as "normal" vertical scroll messages. short gcWheelDelta; //wheel delta from roll WORD wKey; // The wnd I get is not the same as WM_VSCROLL : above gets... // Note to self: Fix it... // Seems like the main app window gets the message, rather than // the MDI clients... gcWheelDelta = HIWORD(wparam); wKey = LOWORD(wparam); // Scroll wheel upwards gives 120 // " " downward " -120 if( wnd != GUICurrWnd ) // Send to child window with focus wnd = GUICurrWnd; if( gcWheelDelta > 0 ) { // positive - scroll up if( wKey == MK_CONTROL || wKey == MK_SHIFT ) GUIProcessScrollMsg( wnd, WM_VSCROLL, SB_PAGEUP, 0L ); else GUIProcessScrollMsg( wnd, WM_VSCROLL, SB_LINEUP, 0L ); } else { // negative - scroll down if( wKey == MK_CONTROL || wKey == MK_SHIFT ) GUIProcessScrollMsg( wnd, WM_VSCROLL, SB_PAGEDOWN, 0L ); else GUIProcessScrollMsg( wnd, WM_VSCROLL, SB_LINEDOWN, 0L ); } // Inform GUI system we are done with scrolling for now. GUIProcessScrollMsg( wnd, WM_VSCROLL, SB_ENDSCROLL, 0 ); } return( 0L ); #endif case WM_MOVE : use_defproc = TRUE; if( wnd->flags & DOING_CLOSE ) { break; } if( !GUIParentHasFlags( wnd, IS_MINIMIZED ) ) { GUIEVENTWND( wnd, GUI_MOVE, NULL ); } use_defproc = TRUE; break; case WM_SIZE: use_defproc = TRUE; if( wnd->flags & DOING_CLOSE ) { break; } if( _wpi_isiconic( _wpi_getframe( hwnd ) ) ) { wnd->flags |= IS_MINIMIZED; if( wnd->style & GUI_CHANGEABLE_FONT ) { GUIEnableSysMenuItem( wnd, GUI_CHANGE_FONT, FALSE ); } GUIEVENTWND( wnd, GUI_ICONIFIED, NULL ); if( GUIMDI ) { GUIBringNewToFront( wnd ); } } else { wnd->flags &= ~IS_MINIMIZED; size.x = _wpi_getwmsizex( wparam, lparam ); size.y = _wpi_getwmsizey( wparam, lparam ); GUIDoResize( wnd, hwnd, &size ); if( wnd->flags & IS_ROOT ) { win = GUIGetParentFrameHWND( wnd ); if( !_wpi_isiconic( win ) ) { GUIMaximizeZoomedChildren( wnd ); } } } //Call back to tell about resizing so system tray can be used WndSizeChange( hwnd, wparam, lparam ); break; case WM_MOUSEMOVE: currentpoint.x = GET_WM_MOUSEMOVE_POSX( wparam, lparam ); currentpoint.y = GET_WM_MOUSEMOVE_POSY( wparam, lparam ); point.x = currentpoint.x; point.y = currentpoint.y; GUIScreenToScaleR( &point ); if( ( currentpoint.x != prevpoint.x ) || ( currentpoint.y != prevpoint.y ) ) { prevpoint.x = currentpoint.x; prevpoint.y = currentpoint.y; SendPointEvent( wparam, lparam, wnd, GUI_MOUSEMOVE, TRUE ); } break; #ifndef __OS2_PM__ case WM_NCLBUTTONDOWN : case WM_NCMBUTTONDOWN : case WM_NCRBUTTONDOWN : CheckDoFront( wnd ); use_defproc = TRUE; break; case WM_RBUTTONDOWN: _wpi_setcapture( hwnd ); CheckDoFront( wnd ); SendPointEvent( wparam, lparam, wnd, GUI_RBUTTONDOWN, TRUE ); break; #else case WM_RBUTTONDOWN : WPI_MAKEPOINT( wparam, lparam, currentpoint ); win = PM1632WinWindowFromPoint( hwnd, ¤tpoint, FALSE ); if( ( win != (HWND)NULL) && ( win != hwnd ) ) { control_id = _wpi_getdlgctrlid( win ); if( control_id != 0 ) { GUIEVENTWND( wnd, GUI_CONTROL_RCLICKED, &control_id ); } } else { _wpi_setcapture( hwnd ); CheckDoFront( wnd ); SendPointEvent( wparam, lparam, wnd, GUI_RBUTTONDOWN, TRUE ); } break; #endif case WM_LBUTTONDOWN: _wpi_setcapture( hwnd ); CheckDoFront( wnd ); SendPointEvent( wparam, lparam, wnd, GUI_LBUTTONDOWN, TRUE ); use_defproc = TRUE; break; case WM_LBUTTONUP: _wpi_releasecapture(); SendPointEvent( wparam, lparam, wnd, GUI_LBUTTONUP, TRUE ); use_defproc = TRUE; break; case WM_RBUTTONUP: _wpi_releasecapture(); SendPointEvent( wparam, lparam, wnd, GUI_RBUTTONUP, TRUE ); break; case WM_LBUTTONDBLCLK: CheckDoFront( wnd ); SendPointEvent( wparam, lparam, wnd, GUI_LBUTTONDBLCLK, TRUE ); break; case WM_RBUTTONDBLCLK: CheckDoFront( wnd ); SendPointEvent( wparam, lparam, wnd, GUI_RBUTTONDBLCLK, TRUE ); break; case WM_SYSCOMMAND: param = _wpi_getid( wparam ); switch( param ) { case SC_NEXTWINDOW : if( GUIMDI ) { NextWndToFront( hwnd ); return( 0L ); } default : if( ( param & 0xf000 ) == ( SC_NEXTWINDOW & 0xf000 ) ) { /* top value same for all SC_* values */ return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); } else { ProcessMenu( wnd, param ); } break; } break; #ifdef __OS2_PM__ case WM_CONTROL : GUIProcessControlNotification( SHORT1FROMMP(wparam), SHORT2FROMMP(wparam), wnd ); break; #else case WM_PARENTNOTIFY: if( ( LOWORD(wparam) == WM_RBUTTONDOWN ) || ( LOWORD(wparam) == WM_LBUTTONDOWN ) || ( LOWORD(wparam) == WM_MBUTTONDOWN ) ) { if( wnd->root == NULLHANDLE ) { CheckDoFront( wnd ); } } if( LOWORD(wparam) == WM_RBUTTONDOWN ) { WPI_MAKEPOINT( wparam, lparam, currentpoint ); MapWindowPoints( hwnd, (HWND)NULL, ¤tpoint, 1 ); win = _wpi_windowfrompoint( currentpoint ); control_id = _wpi_getdlgctrlid( win ); if( control_id != 0 ) { if( _wpi_getparent(win) == hwnd ) { GUIEVENTWND( wnd, GUI_CONTROL_RCLICKED, &control_id ); } } } break; case WM_ENDSESSION : { gui_end_session es; es.endsession = (bool)wparam; es.logoff = (bool)( lparam == 0x80000000L ); GUIEVENTWND( wnd, GUI_ENDSESSION, &es ); return( 0L ); } case WM_QUERYENDSESSION : { gui_end_session es; es.endsession = (bool)wparam; es.logoff = (bool)( lparam == 0x80000000L ); // ENDSESSION_LOGOFF if( !GUIEVENTWND( wnd, GUI_QUERYENDSESSION, &es ) ) { return( TRUE ); } return( 0L ); } #endif case WM_COMMAND: if( _wpi_ismenucommand( wparam, lparam ) || IsToolBarCommand( wnd, wparam, lparam ) ) { /* from menu or toolbar */ ProcessMenu( wnd, _wpi_getid( wparam ) ); //SetFocusToParent(); } else { GUIProcessControlMsg( wparam, lparam, wnd, NULL ); } use_defproc = TRUE; break; #ifndef __OS2_PM__ case WM_VKEYTOITEM : use_defproc = FALSE; ret = -1; GUIGetKeyState( &key_state.state ); if( ( GUIWindowsMapKey( wparam, lparam, &key_state.key ) ) ) { ret = GUIEVENTWND( wnd, GUI_KEYTOITEM, &key_state ); } break; #endif #ifdef __OS2_PM__ case WM_CHAR : case WM_TRANSLATEACCEL : #else case WM_MENUCHAR : case WM_SYSKEYDOWN : case WM_SYSKEYUP : case WM_KEYUP : case WM_KEYDOWN : #endif return( GUIProcesskey( hwnd, msg, wparam, lparam ) ); case WM_CLOSE : if( wnd->flags & DOING_CLOSE ) { return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); } else if( wnd->style & GUI_CLOSEABLE ) { if( GUIEVENTWND( wnd, GUI_CLOSE, NULL ) ) { wnd->flags |= DOING_CLOSE; if( wnd->flags & IS_ROOT ) { return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); } else { _wpi_destroywindow( wnd->hwnd_frame ); } } } return( 0L ); // Message to deal with tray icons (Win 95 and NT 4.0 ). case WM_TRAYCALLBACK : TrayCallBack( hwnd, wparam, lparam ); return( 0L ); case WM_DESTROY : wnd->flags |= DOING_DESTROY; NumWindows--; GUIEVENTWND( wnd, GUI_DESTROY, NULL ); //ret = _wpi_defwindowproc( hwnd, msg, wparam, lparam ); GUIDestroyAllChildren( wnd ); if( wnd->flags & IS_ROOT ) { GUIDestroyAllPopupsWithNoParent(); } GUIFreeWindowMemory( wnd, FALSE, FALSE ); if( NumWindows == 0 ) { _wpi_postquitmessage( 0 ); Posted = TRUE; } return( 0L ); default: use_defproc = TRUE; } if( use_defproc ) { return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); } else { return( ret ); } }