/////////////////////////////////////////////////////////////////////////////
-// Name: frame.cpp
+// Name: src/os2/frame.cpp
// Purpose: wxFrame
// Author: David Webster
// Modified by:
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
- #include "wx/defs.h"
#include "wx/object.h"
#include "wx/dynarray.h"
#include "wx/list.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/event.h"
- #include "wx/setup.h"
#include "wx/frame.h"
#include "wx/menu.h"
#include "wx/app.h"
#include "wx/settings.h"
#include "wx/dcclient.h"
#include "wx/mdi.h"
+ #include "wx/toolbar.h"
+ #include "wx/statusbr.h"
+ #include "wx/menuitem.h"
#endif // WX_PRECOMP
#include "wx/os2/private.h"
-#if wxUSE_STATUSBAR
- #include "wx/statusbr.h"
- #include "wx/generic/statusbr.h"
-#endif // wxUSE_STATUSBAR
-
-#if wxUSE_TOOLBAR
- #include "wx/toolbar.h"
-#endif // wxUSE_TOOLBAR
-
-#include "wx/menuitem.h"
-#include "wx/log.h"
-
// ----------------------------------------------------------------------------
// globals
// ----------------------------------------------------------------------------
-extern wxList WXDLLEXPORT wxPendingDelete;
-
#if wxUSE_MENUS_NATIVE
extern wxMenu *wxCurrentPopupMenu;
#endif
-extern void wxAssociateWinWithHandle( HWND hWnd
- ,wxWindowOS2* pWin
- );
-
// ----------------------------------------------------------------------------
// event tables
// ----------------------------------------------------------------------------
#if wxUSE_NATIVE_STATUSBAR
bool wxFrame::m_bUseNativeStatusBar = true;
#else
- bool wxFrame::m_bUseNativeStatusBar = FALSE;
+ bool wxFrame::m_bUseNativeStatusBar = false;
#endif
#endif //wxUSE_STATUSBAR
m_nFsStatusBarHeight = 0;
m_nFsToolBarHeight = 0;
m_hWndToolTip = 0L;
- m_bWasMinimized = FALSE;
+ m_bWasMinimized = false;
m_frameMenuBar = NULL;
memset(&m_vSwpVScroll, 0, sizeof(SWP));
memset(&m_vSwpStatusBar, 0, sizeof(SWP));
memset(&m_vSwpToolBar, 0, sizeof(SWP));
- m_bIconized = FALSE;
+ m_bIconized = false;
} // end of wxFrame::Init
int nHeight = ((11 * nY) / 10 + 2 * pStatusBar->GetBorderY());
- pStatusBar->SetSize( -1
- ,-1
- ,-1
+ pStatusBar->SetSize( wxDefaultCoord
+ ,wxDefaultCoord
+ ,wxDefaultCoord
,nHeight
);
- ::WinSetParent( pStatusBar->GetHWND()
- ,m_hFrame
- ,FALSE
- );
- ::WinSetOwner( pStatusBar->GetHWND()
- ,m_hFrame
- );
+ ::WinSetParent( pStatusBar->GetHWND(), m_hFrame, FALSE );
+ ::WinSetOwner( pStatusBar->GetHWND(), m_hFrame);
//
// to show statusbar
//
{
vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError);
- wxLogError(_T("Error setting parent for StautsBar. Error: %s\n"), sError.c_str());
+ wxLogError(_T("Error setting parent for StatusBar. Error: %s\n"), sError.c_str());
return;
}
}
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
-wxToolBar* wxFrame::OnCreateToolBar(
- long lStyle
-, wxWindowID vId
-, const wxString& rsName
-)
+wxToolBar* wxFrame::OnCreateToolBar( long lStyle, wxWindowID vId, const wxString& rsName )
{
wxToolBar* pToolBar = wxFrameBase::OnCreateToolBar( lStyle
,vId
,rsName
);
- ::WinSetParent( pToolBar->GetHWND()
- ,m_hFrame
- ,FALSE
- );
- ::WinSetOwner( pToolBar->GetHWND()
- ,m_hFrame
- );
+ ::WinSetParent( pToolBar->GetHWND(), m_hFrame, FALSE);
+ ::WinSetOwner( pToolBar->GetHWND(), m_hFrame);
return pToolBar;
} // end of WinGuiBase_CFrame::OnCreateToolBar
#endif
wxSysColourChangedEvent vEvent2;
vEvent2.SetEventObject(m_frameStatusBar);
- m_frameStatusBar->GetEventHandler()->ProcessEvent(vEvent2);
+ m_frameStatusBar->HandleWindowEvent(vEvent2);
}
#endif //wxUSE_STATUSBAR
if (bShow)
{
if (IsFullScreen())
- return FALSE;
+ return false;
m_bFsIsShowing = true;
m_lFsStyle = lStyle;
//
if ((lStyle & wxFULLSCREEN_NOTOOLBAR) && pTheToolBar)
{
- pTheToolBar->SetSize(-1,0);
- pTheToolBar->Show(FALSE);
+ pTheToolBar->SetSize(wxDefaultCoord,0);
+ pTheToolBar->Show(false);
}
#endif //wxUSE_TOOLBAR
::WinQueryWindowRect(HWND_DESKTOP, &vRect);
nWidth = vRect.xRight - vRect.xLeft;
//
- // Rmember OS/2 is backwards!
+ // Remember OS/2 is backwards!
//
nHeight = vRect.yTop - vRect.yBottom;
wxSize sz( nWidth, nHeight );
wxSizeEvent vEvent( sz, GetId() );
- GetEventHandler()->ProcessEvent(vEvent);
+ HandleWindowEvent(vEvent);
return true;
}
else
//
if (pTheToolBar && (m_lFsStyle & wxFULLSCREEN_NOTOOLBAR))
{
- pTheToolBar->SetSize(-1, m_nFsToolBarHeight);
+ pTheToolBar->SetSize(wxDefaultCoord, m_nFsToolBarHeight);
pTheToolBar->Show(true);
}
#endif //wxUSE_TOOLBAR
,&vTHeight
);
- if (pToolBar->GetWindowStyleFlag() & wxTB_HORIZONTAL)
+ if (pToolBar->GetWindowStyleFlag() & wxTB_TOP)
{
vWidth = (wxCoord)(vRect.xRight - vRect.xLeft);
pToolBar->SetSize( vRect.xLeft - vFRect.xLeft
,vTHeight
);
}
+ else if (pToolBar->GetWindowStyleFlag() & wxTB_BOTTOM)
+ {
+ wxCoord vSwidth = 0;
+ wxCoord vSheight = 0;
+
+ if (m_frameStatusBar)
+ m_frameStatusBar->GetSize( &vSwidth
+ ,&vSheight
+ );
+ vWidth = (wxCoord)(vRect.xRight - vRect.xLeft);
+ pToolBar->SetSize( vRect.xLeft - vFRect.xLeft
+ ,vFRect.yTop - vRect.yBottom - vTHeight - vSheight
+ ,vWidth
+ ,vTHeight
+ );
+ }
+ else if (pToolBar->GetWindowStyleFlag() & wxTB_LEFT)
+ {
+ wxCoord vSwidth = 0;
+ wxCoord vSheight = 0;
+
+ if (m_frameStatusBar)
+ m_frameStatusBar->GetSize( &vSwidth
+ ,&vSheight
+ );
+ vHeight = (wxCoord)(vRect.yTop - vRect.yBottom);
+ pToolBar->SetSize( vRect.xLeft - vRect.xLeft
+ ,vPos.y
+ ,vTWidth
+ ,vHeight - vSheight
+ );
+ }
else
{
wxCoord vSwidth = 0;
,&vSheight
);
vHeight = (wxCoord)(vRect.yTop - vRect.yBottom);
- pToolBar->SetSize( vRect.xLeft - vFRect.xLeft
+ pToolBar->SetSize( vRect.xRight - vFRect.xLeft - vTWidth
,vPos.y
,vTWidth
,vHeight - vSheight
// ---------------------------------------------------------------------------
// preprocessing
// ---------------------------------------------------------------------------
-bool wxFrame::OS2TranslateMessage(
- WXMSG* pMsg
-)
+bool wxFrame::OS2TranslateMessage( WXMSG* pMsg )
{
//
// try the menu bar accels
//
- wxMenuBar* pMenuBar = GetMenuBar();
+ wxMenuBar* pMenuBar = GetMenuBar();
if (!pMenuBar)
- return FALSE;
+ return false;
#if wxUSE_ACCEL && wxUSE_MENUS_NATIVE
const wxAcceleratorTable& rAcceleratorTable = pMenuBar->GetAccelTable();
return rAcceleratorTable.Translate(GetHWND(), pMsg);
#else
- return FALSE;
+ return false;
#endif //wxUSE_ACCEL
} // end of wxFrame::OS2TranslateMessage
::WinQueryWindowRect(GetHwnd(), &vRect3);
-#ifndef __WATCOMC__
-// FIXME: incomplete headers ???
-
static const int nIconWidth = 32;
static const int nIconHeight = 32;
int nIconX = (int)((vRect3.xRight - nIconWidth)/2);
int nIconY = (int)((vRect3.yBottom + nIconHeight)/2);
::WinDrawPointer(hPs, nIconX, nIconY, hIcon, DP_NORMAL);
-#endif
}
::WinEndPaint(hPs);
}
return true;
} // end of wxFrame::HandlePaint
-bool wxFrame::HandleSize(
- int nX
-, int nY
-, WXUINT nId
-)
+bool wxFrame::HandleSize( int nX, int nY, WXUINT nId )
{
- bool bProcessed = FALSE;
+ bool bProcessed = false;
switch (nId)
{
//
// restore all child frames too
//
- IconizeChildFrames(FALSE);
- (void)SendIconizeEvent(FALSE);
+ IconizeChildFrames(false);
+ (void)SendIconizeEvent(false);
//
// fall through
//
case kSizeMax:
- m_bIconized = FALSE;
+ m_bIconized = false;
break;
case kSizeMin:
//
// Iconize all child frames too
//
- IconizeChildFrames(TRUE);
+ IconizeChildFrames(true);
(void)SendIconizeEvent();
m_bIconized = true;
break;
return false;
} // end of wxFrame::HandleCommand
-bool wxFrame::HandleMenuSelect(
- WXWORD nItem
-, WXWORD nFlags
-, WXHMENU hMenu
-)
+bool wxFrame::HandleMenuSelect( WXWORD nItem,
+ WXWORD nFlags,
+ WXHMENU hMenu )
{
if( !nFlags )
{
wxMenuEvent vEvent(wxEVT_MENU_HIGHLIGHT, nItem);
vEvent.SetEventObject(this);
- GetEventHandler()->ProcessEvent(vEvent); // return value would be ignored by PM
+ HandleWindowEvent(vEvent); // return value would be ignored by PM
}
else
{
- DoGiveHelp(wxEmptyString, FALSE);
- return FALSE;
+ DoGiveHelp(wxEmptyString, true);
+ return false;
}
}
- return TRUE;
+ return true;
} // end of wxFrame::HandleMenuSelect
// ---------------------------------------------------------------------------
// Main Frame window proc
// ---------------------------------------------------------------------------
-MRESULT EXPENTRY wxFrameMainWndProc(
- HWND hWnd
-, ULONG ulMsg
-, MPARAM wParam
-, MPARAM lParam
-)
+MRESULT EXPENTRY wxFrameMainWndProc( HWND hWnd,
+ ULONG ulMsg,
+ MPARAM wParam,
+ MPARAM lParam )
{
- MRESULT rc = (MRESULT)0;
- bool bProcessed = FALSE;
- wxFrame* pWnd = NULL;
+ MRESULT rc = (MRESULT)0;
+ bool bProcessed = false;
+ wxFrame* pWnd = NULL;
pWnd = (wxFrame*) wxFindWinFromHandle((WXHWND) hWnd);
switch (ulMsg)
{
if(pWnd->m_hWnd && pSWP[i].hwnd == pWnd->m_hWnd)
{
- if (pWnd->m_frameToolBar && pWnd->m_frameToolBar->GetWindowStyleFlag() & wxTB_HORIZONTAL)
+ if (pWnd->m_frameToolBar && pWnd->m_frameToolBar->GetWindowStyleFlag() & wxTB_TOP)
{
pSWP[i].x = vRectl.xLeft;
pSWP[i].y = vRectl.yBottom + nHeight;
pSWP[i].cx = vRectl.xRight - vRectl.xLeft;
pSWP[i].cy = vRectl.yTop - vRectl.yBottom - (nHeight + nHeight2);
}
- else
+ else if (pWnd->m_frameToolBar && pWnd->m_frameToolBar->GetWindowStyleFlag() & wxTB_BOTTOM)
+ {
+ pSWP[i].x = vRectl.xLeft;
+ pSWP[i].y = vRectl.yBottom + nHeight + nHeight2;
+ pSWP[i].cx = vRectl.xRight - vRectl.xLeft;
+ pSWP[i].cy = vRectl.yTop - vRectl.yBottom - (nHeight + nHeight2);
+ }
+ else if (pWnd->m_frameToolBar && pWnd->m_frameToolBar->GetWindowStyleFlag() & wxTB_LEFT)
{
pSWP[i].x = vRectl.xLeft + nWidth;
pSWP[i].y = vRectl.yBottom + nHeight;
pSWP[i].cx = vRectl.xRight - (vRectl.xLeft + nWidth);
pSWP[i].cy = vRectl.yTop - vRectl.yBottom - nHeight;
}
+ else
+ {
+ pSWP[i].x = vRectl.xLeft;
+ pSWP[i].y = vRectl.yBottom + nHeight;
+ pSWP[i].cx = vRectl.xRight - (vRectl.xLeft + nWidth);
+ pSWP[i].cy = vRectl.yTop - vRectl.yBottom - nHeight;
+ }
pSWP[i].fl = SWP_SIZE | SWP_MOVE | SWP_SHOW;
pSWP[i].hwndInsertBehind = HWND_TOP;
}
}
- bProcessed = TRUE;
+ bProcessed = true;
rc = MRFROMSHORT(nItemCount);
}
break;
return rc;
} // end of wxFrameWndProc
-MRESULT wxFrame::OS2WindowProc(
- WXUINT uMessage
-, WXWPARAM wParam
-, WXLPARAM lParam
-)
+MRESULT wxFrame::OS2WindowProc( WXUINT uMessage,
+ WXWPARAM wParam,
+ WXLPARAM lParam )
{
- MRESULT mRc = 0L;
- bool bProcessed = FALSE;
+ MRESULT mRc = 0L;
+ bool bProcessed = false;
switch (uMessage)
{
// Duh...nothing to do under OS/2
}
-void wxFrame::SetClient(
- wxWindow* pWindow
-)
+void wxFrame::SetClient( wxWindow* pWindow )
{
- wxWindow* pOldClient = this->GetClient();
- bool bClientHasFocus = pOldClient && (pOldClient == wxWindow::FindFocus());
+ wxWindow* pOldClient = this->GetClient();
+ bool bClientHasFocus = pOldClient && (pOldClient == wxWindow::FindFocus());
if(pOldClient == pWindow) // nothing to do
return;
if(bClientHasFocus )
this->SetFocus();
- pOldClient->Enable( FALSE );
- pOldClient->Show( FALSE );
+ pOldClient->Enable( false );
+ pOldClient->Show( false );
::WinSetWindowUShort(pOldClient->GetHWND(), QWS_ID, (USHORT)pOldClient->GetId());
// to avoid OS/2 bug need to update frame
::WinSendMsg((HWND)this->GetFrame(), WM_UPDATEFRAME, (MPARAM)~0, 0);
::WinEnableWindowUpdate((HWND)GetHWND(), FALSE);
if(pOldClient)
{
- pOldClient->Enable(FALSE);
- pOldClient->Show(FALSE);
+ pOldClient->Enable(false);
+ pOldClient->Show(false);
::WinSetWindowUShort(pOldClient->GetHWND(), QWS_ID, (USHORT)pOldClient->GetId());
}
pWindow->Reparent(this);