/////////////////////////////////////////////////////////////////////////////
// Name: frame.cpp
-// Purpose: wxFrameOS2
+// Purpose: wxFrame
// Author: David Webster
// Modified by:
// Created: 10/27/99
extern wxWindowList wxModelessWindows;
extern wxList WXDLLEXPORT wxPendingDelete;
extern wxChar wxFrameClassName[];
+
+#if wxUSE_MENUS_NATIVE
extern wxMenu *wxCurrentPopupMenu;
+#endif
-extern void wxAssociateWinWithHandle( HWND hWnd
- ,wxWindow* pWin
+extern void wxAssociateWinWithHandle( HWND hWnd
+ ,wxWindowOS2* pWin
);
// ----------------------------------------------------------------------------
// event tables
// ----------------------------------------------------------------------------
-BEGIN_EVENT_TABLE(wxFrameOS2, wxFrameBase)
- EVT_ACTIVATE(wxFrameOS2::OnActivate)
- EVT_SYS_COLOUR_CHANGED(wxFrameOS2::OnSysColourChanged)
+BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
+ EVT_ACTIVATE(wxFrame::OnActivate)
+ EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
END_EVENT_TABLE()
-#ifndef __WXUNIVERSAL__
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
-#endif
// ============================================================================
// implementation
#if wxUSE_STATUSBAR
#if wxUSE_NATIVE_STATUSBAR
- bool wxFrameOS2::m_bUseNativeStatusBar = TRUE;
+ bool wxFrame::m_bUseNativeStatusBar = TRUE;
#else
- bool wxFrameOS2::m_bUseNativeStatusBar = FALSE;
+ bool wxFrame::m_bUseNativeStatusBar = FALSE;
#endif
#endif //wxUSE_STATUSBAR
// creation/destruction
// ----------------------------------------------------------------------------
-void wxFrameOS2::Init()
+void wxFrame::Init()
{
m_bIconized = FALSE;
memset(&m_vSwpVScroll, 0, sizeof(SWP));
memset(&m_vSwpStatusBar, 0, sizeof(SWP));
memset(&m_vSwpToolBar, 0, sizeof(SWP));
-} // end of wxFrameOS2::Init
+} // end of wxFrame::Init
-bool wxFrameOS2::Create(
+bool wxFrame::Create(
wxWindow* pParent
, wxWindowID vId
, const wxString& rsTitle
wxModelessWindows.Append(this);
}
return(bOk);
-} // end of wxFrameOS2::Create
+} // end of wxFrame::Create
-wxFrameOS2::~wxFrameOS2()
+wxFrame::~wxFrame()
{
m_isBeingDeleted = TRUE;
);
}
}
-} // end of wxFrameOS2::~wxFrame
+} // end of wxFrame::~wxFrame
//
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
//
-void wxFrameOS2::DoGetClientSize(
+void wxFrame::DoGetClientSize(
int* pX
, int* pY
) const
*pX = vRect.xRight - vRect.xLeft;
if (pY)
*pY = vRect.yTop - vRect.yBottom;
-} // end of wxFrameOS2::DoGetClientSize
+} // end of wxFrame::DoGetClientSize
//
// Set the client size (i.e. leave the calculation of borders etc.
// to wxWindows)
//
-void wxFrameOS2::DoSetClientSize(
+void wxFrame::DoSetClientSize(
int nWidth
, int nHeight
)
);
vEvent.SetEventObject(this);
GetEventHandler()->ProcessEvent(vEvent);
-} // end of wxFrameOS2::DoSetClientSize
+} // end of wxFrame::DoSetClientSize
-void wxFrameOS2::DoGetSize(
+void wxFrame::DoGetSize(
int* pWidth
, int* pHeight
) const
::WinQueryWindowRect(m_hFrame, &vRect);
*pWidth = vRect.xRight - vRect.xLeft;
*pHeight = vRect.yTop - vRect.yBottom;
-} // end of wxFrameOS2::DoGetSize
+} // end of wxFrame::DoGetSize
-void wxFrameOS2::DoGetPosition(
+void wxFrame::DoGetPosition(
int* pX
, int* pY
) const
*pX = vRect.xRight - vRect.xLeft;
*pY = vRect.yTop - vRect.yBottom;
-} // end of wxFrameOS2::DoGetPosition
+} // end of wxFrame::DoGetPosition
// ----------------------------------------------------------------------------
// variations around ::ShowWindow()
// ----------------------------------------------------------------------------
-void wxFrameOS2::DoShowWindow(
+void wxFrame::DoShowWindow(
int bShowCmd
)
{
::WinShowWindow(m_hFrame, (BOOL)bShowCmd);
m_bIconized = bShowCmd == SWP_MINIMIZE;
-} // end of wxFrameOS2::DoShowWindow
+} // end of wxFrame::DoShowWindow
-bool wxFrameOS2::Show(
+bool wxFrame::Show(
bool bShow
)
{
}
}
return TRUE;
-} // end of wxFrameOS2::Show
+} // end of wxFrame::Show
-void wxFrameOS2::Iconize(
+void wxFrame::Iconize(
bool bIconize
)
{
DoShowWindow(bIconize ? SWP_MINIMIZE : SWP_RESTORE);
-} // end of wxFrameOS2::Iconize
+} // end of wxFrame::Iconize
-void wxFrameOS2::Maximize(
+void wxFrame::Maximize(
bool bMaximize)
{
DoShowWindow(bMaximize ? SWP_MAXIMIZE : SWP_RESTORE);
-} // end of wxFrameOS2::Maximize
+} // end of wxFrame::Maximize
-void wxFrameOS2::Restore()
+void wxFrame::Restore()
{
DoShowWindow(SWP_RESTORE);
-} // end of wxFrameOS2::Restore
+} // end of wxFrame::Restore
-bool wxFrameOS2::IsIconized() const
+bool wxFrame::IsIconized() const
{
SWP vSwp;
else
((wxFrame*)this)->m_bIconized = FALSE;
return m_bIconized;
-} // end of wxFrameOS2::IsIconized
+} // end of wxFrame::IsIconized
// Is it maximized?
-bool wxFrameOS2::IsMaximized() const
+bool wxFrame::IsMaximized() const
{
SWP vSwp;
bool bIconic;
::WinQueryWindowPos(m_hFrame, &vSwp);
return (vSwp.fl & SWP_MAXIMIZE);
-} // end of wxFrameOS2::IsMaximized
+} // end of wxFrame::IsMaximized
-void wxFrameOS2::SetIcon(
+void wxFrame::SetIcon(
const wxIcon& rIcon
)
{
,(MPARAM)0
);
}
-} // end of wxFrameOS2::SetIcon
+} // end of wxFrame::SetIcon
#if wxUSE_STATUSBAR
-wxStatusBar* wxFrameOS2::OnCreateStatusBar(
+wxStatusBar* wxFrame::OnCreateStatusBar(
int nNumber
, long lulStyle
, wxWindowID vId
::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)~0, 0);
return pStatusBar;
-} // end of wxFrameOS2::OnCreateStatusBar
+} // end of wxFrame::OnCreateStatusBar
-void wxFrameOS2::PositionStatusBar()
+void wxFrame::PositionStatusBar()
{
SWP vSwp;
ERRORID vError;
return;
}
}
-} // end of wxFrameOS2::PositionStatusBar
+} // end of wxFrame::PositionStatusBar
#endif // wxUSE_STATUSBAR
-void wxFrameOS2::DetachMenuBar()
+#if wxUSE_MENUS_NATIVE
+void wxFrame::DetachMenuBar()
{
if (m_frameMenuBar)
{
m_frameMenuBar->Detach();
m_frameMenuBar = NULL;
}
-} // end of wxFrameOS2::DetachMenuBar
+} // end of wxFrame::DetachMenuBar
-void wxFrameOS2::SetMenuBar(
+void wxFrame::SetMenuBar(
wxMenuBar* pMenuBar
)
{
m_frameMenuBar = pMenuBar;
pMenuBar->Attach((wxFrame*)this);
}
-} // end of wxFrameOS2::SetMenuBar
+} // end of wxFrame::SetMenuBar
-void wxFrameOS2::AttachMenuBar(
+void wxFrame::AttachMenuBar(
wxMenuBar* pMenubar
)
{
+ wxFrameBase::AttachMenuBar(pMenubar);
+
m_frameMenuBar = pMenubar;
if (!pMenubar)
}
InternalSetMenuBar();
}
-} // end of wxFrameOS2::AttachMenuBar
+} // end of wxFrame::AttachMenuBar
-void wxFrameOS2::InternalSetMenuBar()
+void wxFrame::InternalSetMenuBar()
{
ERRORID vError;
wxString sError;
wxLogError("Error setting parent for submenu. Error: %s\n", sError);
}
::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
-} // end of wxFrameOS2::InternalSetMenuBar
+} // end of wxFrame::InternalSetMenuBar
+#endif // wxUSE_MENUS_NATIVE
//
// Responds to colour changes, and passes event on to children
//
-void wxFrameOS2::OnSysColourChanged(
+void wxFrame::OnSysColourChanged(
wxSysColourChangedEvent& rEvent
)
{
// Propagate the event to the non-top-level children
//
wxWindow::OnSysColourChanged(rEvent);
-} // end of wxFrameOS2::OnSysColourChanged
+} // end of wxFrame::OnSysColourChanged
// Pass TRUE to show full screen, FALSE to restore.
-bool wxFrameOS2::ShowFullScreen(
+bool wxFrame::ShowFullScreen(
bool bShow
, long lStyle
)
m_lFsStyle = lStyle;
#if wxUSE_TOOLBAR
- wxToolBar* pTheToolBar = GetToolBar();
+ wxToolBar* pTheToolBar = GetToolBar();
#endif //wxUSE_TOOLBAR
#if wxUSE_STATUSBAR
- wxStatusBar* pTheStatusBar = GetStatusBar();
+ wxStatusBar* pTheStatusBar = GetStatusBar();
#endif //wxUSE_STATUSBAR
int nDummyWidth;
);
return TRUE;
}
-} // end of wxFrameOS2::ShowFullScreen
+} // end of wxFrame::ShowFullScreen
//
// Frame window
//
-bool wxFrameOS2::OS2Create(
+bool wxFrame::OS2Create(
int nId
, wxWindow* pParent
, const wxChar* zWclass
return FALSE;
}
return TRUE;
-} // end of wxFrameOS2::OS2Create
+} // end of wxFrame::OS2Create
//
// Default activation behaviour - set the focus for the first child
// subwindow found.
//
-void wxFrameOS2::OnActivate(
+void wxFrame::OnActivate(
wxActivateEvent& rEvent
)
{
}
}
}
-} // end of wxFrameOS2::OnActivate
+} // end of wxFrame::OnActivate
// ----------------------------------------------------------------------------
// wxFrame size management: we exclude the areas taken by menu/status/toolbars
// ----------------------------------------------------------------------------
// Checks if there is a toolbar, and returns the first free client position
-wxPoint wxFrameOS2::GetClientAreaOrigin() const
+wxPoint wxFrame::GetClientAreaOrigin() const
{
wxPoint vPoint(0, 0);
}
#endif //wxUSE_TOOLBAR
return vPoint;
-} // end of wxFrameOS2::GetClientAreaOrigin
+} // end of wxFrame::GetClientAreaOrigin
// ----------------------------------------------------------------------------
// tool/status bar stuff
#if wxUSE_TOOLBAR
-wxToolBar* wxFrameOS2::CreateToolBar(
+wxToolBar* wxFrame::CreateToolBar(
long lStyle
, wxWindowID vId
, const wxString& rName
PositionToolBar();
}
return m_frameToolBar;
-} // end of wxFrameOS2::CreateToolBar
+} // end of wxFrame::CreateToolBar
-void wxFrameOS2::PositionToolBar()
+void wxFrame::PositionToolBar()
{
HWND hWndClient;
RECTL vRect;
,wxSIZE_NO_ADJUSTMENTS
);
}
-} // end of wxFrameOS2::PositionToolBar
+} // end of wxFrame::PositionToolBar
#endif // wxUSE_TOOLBAR
// ----------------------------------------------------------------------------
// Windows behaviour where child frames float independently of the parent one
// on the desktop, but are iconized/restored with it
//
-void wxFrameOS2::IconizeChildFrames(
+void wxFrame::IconizeChildFrames(
bool bIconize
)
{
((wxFrame *)pWin)->Iconize(bIconize);
}
}
-} // end of wxFrameOS2::IconizeChildFrames
+} // end of wxFrame::IconizeChildFrames
// ===========================================================================
// message processing
// ---------------------------------------------------------------------------
// preprocessing
// ---------------------------------------------------------------------------
-bool wxFrameOS2::OS2TranslateMessage(
+bool wxFrame::OS2TranslateMessage(
WXMSG* pMsg
)
{
//
wxMenuBar* pMenuBar = GetMenuBar();
- if (!pMenuBar )
+ if (!pMenuBar)
return FALSE;
-#if wxUSE_ACCEL
+#if wxUSE_ACCEL && wxUSE_MENUS_NATIVE
const wxAcceleratorTable& rAcceleratorTable = pMenuBar->GetAccelTable();
return rAcceleratorTable.Translate(GetHWND(), pMsg);
#else
return FALSE;
#endif //wxUSE_ACCEL
-} // end of wxFrameOS2::OS2TranslateMessage
+} // end of wxFrame::OS2TranslateMessage
// ---------------------------------------------------------------------------
// our private (non virtual) message handlers
// ---------------------------------------------------------------------------
-bool wxFrameOS2::HandlePaint()
+bool wxFrame::HandlePaint()
{
RECTL vRect;
return TRUE;
}
return FALSE;
-} // end of wxFrameOS2::HandlePaint
+} // end of wxFrame::HandlePaint
-bool wxFrameOS2::HandleSize(
+bool wxFrame::HandleSize(
int nX
, int nY
, WXUINT nId
bProcessed = GetEventHandler()->ProcessEvent(vEvent);
}
return bProcessed;
-} // end of wxFrameOS2::HandleSize
+} // end of wxFrame::HandleSize
-bool wxFrameOS2::HandleCommand(
+bool wxFrame::HandleCommand(
WXWORD nId
, WXWORD nCmd
, WXHWND hControl
//
if (nCmd == CMDSRC_MENU || nCmd == CMDSRC_ACCELERATOR)
{
+#if wxUSE_MENUS_NATIVE
if (wxCurrentPopupMenu)
{
wxMenu* pPopupMenu = wxCurrentPopupMenu;
return pPopupMenu->OS2Command( nCmd
,nId
);
+ return TRUE;
}
+#endif
if (ProcessCommand(nId))
{
}
}
return FALSE;
-} // end of wxFrameOS2::HandleCommand
+} // end of wxFrame::HandleCommand
-bool wxFrameOS2::HandleMenuSelect(
+bool wxFrame::HandleMenuSelect(
WXWORD nItem
, WXWORD nFlags
, WXHMENU hMenu
}
}
return TRUE;
-} // end of wxFrameOS2::HandleMenuSelect
+} // end of wxFrame::HandleMenuSelect
// ---------------------------------------------------------------------------
// Main Frame window proc
return rc;
} // end of wxFrameWndProc
-MRESULT wxFrameOS2::OS2WindowProc(
+MRESULT wxFrame::OS2WindowProc(
WXUINT uMessage
, WXWPARAM wParam
, WXLPARAM lParam
,lParam
);
return (MRESULT)mRc;
-} // wxFrameOS2::OS2WindowProc
+} // wxFrame::OS2WindowProc
-void wxFrameOS2::SetClient(WXHWND c_Hwnd)
+void wxFrame::SetClient(WXHWND c_Hwnd)
{
// Duh...nothing to do under OS/2
}
-void wxFrameOS2::SetClient(
+void wxFrame::SetClient(
wxWindow* pWindow
)
{
}
}
-wxWindow* wxFrameOS2::GetClient()
+wxWindow* wxFrame::GetClient()
{
return wxFindWinFromHandle((WXHWND)::WinWindowFromID(m_hFrame, FID_CLIENT));
}