X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/93cf77c076b699e8e0b3b0049bd4f80de15997dd..e3e717ecc5add075cd53a04cf24fe27e24170944:/src/stubs/frame.cpp diff --git a/src/stubs/frame.cpp b/src/stubs/frame.cpp index 3d9b5b0004..0a15c650af 100644 --- a/src/stubs/frame.cpp +++ b/src/stubs/frame.cpp @@ -17,6 +17,11 @@ #include "wx/statusbr.h" #include "wx/toolbar.h" #include "wx/menuitem.h" +#include "wx/menu.h" +#include "wx/dcclient.h" +#include "wx/dialog.h" +#include "wx/settings.h" +#include "wx/app.h" extern wxList wxModelessWindows; extern wxList wxPendingDelete; @@ -34,7 +39,7 @@ END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) #endif -#if USE_NATIVE_STATUSBAR +#if wxUSE_NATIVE_STATUSBAR bool wxFrame::m_useNativeStatusBar = TRUE; #else bool wxFrame::m_useNativeStatusBar = FALSE; @@ -158,6 +163,13 @@ bool wxFrame::IsIconized() const return FALSE; } +// Is the frame maximized? +bool wxFrame::IsMaximized(void) const +{ + // TODO + return FALSE; +} + void wxFrame::SetTitle(const wxString& title) { // TODO @@ -175,11 +187,6 @@ void wxFrame::SetIcon(const wxIcon& icon) // TODO } -void wxFrame::SetAcceleratorTable(const wxAcceleratorTable& accel) -{ - m_acceleratorTable = accel; -} - wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id, const wxString& name) { @@ -190,7 +197,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id, // Set the height according to the font and the border size wxClientDC dc(statusBar); - dc.SetFont(* statusBar->GetFont()); + dc.SetFont(statusBar->GetFont()); long x, y; dc.GetTextExtent("X", &x, &y); @@ -264,7 +271,7 @@ void wxFrame::SetMenuBar(wxMenuBar *menuBar) void wxFrame::Fit() { // Work out max. size - wxNode *node = GetChildren()->First(); + wxNode *node = GetChildren().First(); int max_width = 0; int max_height = 0; while (node) @@ -312,7 +319,7 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) void wxFrame::OnSize(wxSizeEvent& event) { // if we're using constraints - do use them - #if USE_CONSTRAINTS + #if wxUSE_CONSTRAINTS if ( GetAutoLayout() ) { Layout(); return; @@ -321,7 +328,7 @@ void wxFrame::OnSize(wxSizeEvent& event) // do we have _exactly_ one child? wxWindow *child = NULL; - for ( wxNode *node = GetChildren()->First(); node; node = node->Next() ) + for ( wxNode *node = GetChildren().First(); node; node = node->Next() ) { wxWindow *win = (wxWindow *)node->Data(); if ( !win->IsKindOf(CLASSINFO(wxFrame)) && @@ -351,37 +358,24 @@ void wxFrame::OnSize(wxSizeEvent& event) // subwindow found. void wxFrame::OnActivate(wxActivateEvent& event) { - for(wxNode *node = GetChildren()->First(); node; node = node->Next()) + for(wxNode *node = GetChildren().First(); node; node = node->Next()) { // Find a child that's a subwindow, but not a dialog box. wxWindow *child = (wxWindow *)node->Data(); if (!child->IsKindOf(CLASSINFO(wxFrame)) && !child->IsKindOf(CLASSINFO(wxDialog))) { -#if WXDEBUG > 1 - wxDebugMsg("wxFrame::OnActivate: about to set the child's focus.\n"); -#endif child->SetFocus(); return; } } } -// The default implementation for the close window event - calls -// OnClose for backward compatibility. +// The default implementation for the close window event. void wxFrame::OnCloseWindow(wxCloseEvent& event) { - // Compatibility - if ( GetEventHandler()->OnClose() || event.GetForce()) - { - this->Destroy(); - } -} - -bool wxFrame::OnClose() -{ - return TRUE; + this->Destroy(); } // Destroy the window (delayed, if a managed window) @@ -457,7 +451,8 @@ void wxFrame::ProcessCommand(int id) } */ - GetEventHandler()->ProcessEvent(commandEvent); + wxEvtHandler* evtHandler = GetEventHandler(); + evtHandler->ProcessEvent(commandEvent); } // Checks if there is a toolbar, and returns the first free client position @@ -481,6 +476,30 @@ wxPoint wxFrame::GetClientAreaOrigin() const return pt; } +void wxFrame::ScreenToClient(int *x, int *y) const +{ + wxWindow::ScreenToClient(x, y); + + // We may be faking the client origin. + // So a window that's really at (0, 30) may appear + // (to wxWin apps) to be at (0, 0). + wxPoint pt(GetClientAreaOrigin()); + *x -= pt.x; + *y -= pt.y; +} + +void wxFrame::ClientToScreen(int *x, int *y) const +{ + // We may be faking the client origin. + // So a window that's really at (0, 30) may appear + // (to wxWin apps) to be at (0, 0). + wxPoint pt1(GetClientAreaOrigin()); + *x += pt1.x; + *y += pt1.y; + + wxWindow::ClientToScreen(x, y); +} + wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) { wxCHECK_MSG( m_frameToolBar == NULL, FALSE, @@ -512,9 +531,6 @@ void wxFrame::PositionToolBar() // the toolbar/status bar were added. // So DEFINITELY replace the line below with something appropriate. - wxCHECK_MSG( TRUE, FALSE, - "PositionToolBar not implemented properly, see frame.cpp" ); - GetClientSize(& cw, &ch); if ( GetStatusBar() )