X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ffecfa5aeb540b54914739dbb8603edbbd4c00a0..68f2155bb74506ee9c26afbc762543133e0ad1a9:/src/palmos/frame.cpp diff --git a/src/palmos/frame.cpp b/src/palmos/frame.cpp index 494bfb23a2..827dd5a307 100644 --- a/src/palmos/frame.cpp +++ b/src/palmos/frame.cpp @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: palmos/frame.cpp +// Name: src/palmos/frame.cpp // Purpose: wxFrame -// Author: William Osborne -// Modified by: +// Author: William Osborne - minimal working wxPalmOS port +// Modified by: Wlodzimierz ABX Skiba - more than minimal functionality // Created: 10/13/04 -// RCS-ID: $Id: -// Copyright: (c) William Osborne +// RCS-ID: $Id$ +// Copyright: (c) William Osborne, Wlodzimierz Skiba // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "frame.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -28,8 +24,9 @@ #pragma hdrstop #endif +#include "wx/frame.h" + #ifndef WX_PRECOMP - #include "wx/frame.h" #include "wx/app.h" #include "wx/menu.h" #include "wx/utils.h" @@ -38,25 +35,22 @@ #include "wx/dcclient.h" #include "wx/mdi.h" #include "wx/panel.h" -#endif // WX_PRECOMP - -#if wxUSE_STATUSBAR - #include "wx/statusbr.h" - #include "wx/generic/statusbr.h" -#endif // wxUSE_STATUSBAR - -#if wxUSE_TOOLBAR + #include "wx/log.h" #include "wx/toolbar.h" -#endif // wxUSE_TOOLBAR + #include "wx/statusbr.h" + #include "wx/menuitem.h" +#endif // WX_PRECOMP -#include "wx/menuitem.h" -#include "wx/log.h" +#include "wx/generic/statusbr.h" #ifdef __WXUNIVERSAL__ #include "wx/univ/theme.h" #include "wx/univ/colschem.h" #endif // __WXUNIVERSAL__ +#include +#include + // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -70,8 +64,7 @@ // ---------------------------------------------------------------------------- BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) - EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) - EVT_PAINT(wxFrame::OnPaint) + EVT_PAINT(wxFrame::OnPaint) END_EVENT_TABLE() #if wxUSE_EXTENDED_RTTI @@ -86,7 +79,7 @@ wxBEGIN_FLAGS( wxFrameStyle ) wxFLAGS_MEMBER(wxBORDER_RAISED) wxFLAGS_MEMBER(wxBORDER_STATIC) wxFLAGS_MEMBER(wxBORDER_NONE) - + // old style border flags wxFLAGS_MEMBER(wxSIMPLE_BORDER) wxFLAGS_MEMBER(wxSUNKEN_BORDER) @@ -108,10 +101,14 @@ wxBEGIN_FLAGS( wxFrameStyle ) // frame styles wxFLAGS_MEMBER(wxSTAY_ON_TOP) wxFLAGS_MEMBER(wxCAPTION) +#if WXWIN_COMPATIBILITY_2_6 wxFLAGS_MEMBER(wxTHICK_FRAME) +#endif // WXWIN_COMPATIBILITY_2_6 wxFLAGS_MEMBER(wxSYSTEM_MENU) wxFLAGS_MEMBER(wxRESIZE_BORDER) +#if WXWIN_COMPATIBILITY_2_6 wxFLAGS_MEMBER(wxRESIZE_BOX) +#endif // WXWIN_COMPATIBILITY_2_6 wxFLAGS_MEMBER(wxCLOSE_BOX) wxFLAGS_MEMBER(wxMAXIMIZE_BOX) wxFLAGS_MEMBER(wxMINIMIZE_BOX) @@ -136,7 +133,7 @@ wxEND_PROPERTIES_TABLE() wxBEGIN_HANDLERS_TABLE(wxFrame) wxEND_HANDLERS_TABLE() -wxCONSTRUCTOR_6( wxFrame , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle) +wxCONSTRUCTOR_6( wxFrame , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle) #else IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow) @@ -146,25 +143,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow) // implementation // ============================================================================ -// ---------------------------------------------------------------------------- -// static class members -// ---------------------------------------------------------------------------- - -#if wxUSE_STATUSBAR - #if wxUSE_NATIVE_STATUSBAR - bool wxFrame::m_useNativeStatusBar = TRUE; - #else - bool wxFrame::m_useNativeStatusBar = FALSE; - #endif -#endif // wxUSE_NATIVE_STATUSBAR - // ---------------------------------------------------------------------------- // creation/destruction // ---------------------------------------------------------------------------- void wxFrame::Init() { - StatusBar=NULL; } bool wxFrame::Create(wxWindow *parent, @@ -175,9 +159,9 @@ bool wxFrame::Create(wxWindow *parent, long style, const wxString& name) { - if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name, this) ) + if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return false; - + return true; } @@ -196,6 +180,10 @@ void wxFrame::DoSetClientSize(int width, int height) // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc. void wxFrame::DoGetClientSize(int *x, int *y) const { + wxSize size = GetSize(); + wxPoint pos = GetClientAreaOrigin(); + *x = size.x - pos.x - 1; + *y = size.y - pos.y - 1; } // ---------------------------------------------------------------------------- @@ -206,56 +194,8 @@ void wxFrame::Raise() { } -// generate an artificial resize event -void wxFrame::SendSizeEvent() -{ -} - -#if wxUSE_STATUSBAR -wxStatusBar *wxFrame::OnCreateStatusBar(int number, - long style, - wxWindowID id, - const wxString& name) -{ - wxStatusBar *statusBar = NULL; - -#if wxUSE_NATIVE_STATUSBAR - if ( !UsesNativeStatusBar() ) - { - statusBar = (wxStatusBar *)new wxStatusBarGeneric(this, id, style); - } - else -#endif - { - statusBar = new wxStatusBar(this, id, style, name); - } - - statusBar->SetFieldsCount(number); - - StatusBar=statusBar; - return statusBar; - - return NULL; -} - -void wxFrame::PositionStatusBar() -{ -} -#endif // wxUSE_STATUSBAR - #if wxUSE_MENUS_NATIVE -void wxFrame::AttachMenuBar(wxMenuBar *menubar) -{ - wxFrameBase::AttachMenuBar(menubar); - - if ( !menubar ) - { - // actually remove the menu from the frame - m_hMenu = (WXHMENU)0; - } -} - void wxFrame::InternalSetMenuBar() { } @@ -264,43 +204,41 @@ bool wxFrame::HandleMenuOpen() { if(!m_frameMenuBar) return false; - + m_frameMenuBar->LoadMenu(); return true; } -bool wxFrame::HandleMenuSelect(int ItemID) +bool wxFrame::HandleMenuSelect(WXEVENTPTR event) { + const EventType *palmEvent = (EventType *)event; + const int ItemID = palmEvent->data.menu.itemID; + if (!m_frameMenuBar) return false; - int item=m_frameMenuBar->ProcessCommand(ItemID); - if(item==-1) + const int item = m_frameMenuBar->ProcessCommand(ItemID); + if (item==-1) return false; wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item); commandEvent.SetEventObject(this); - + GetEventHandler()->ProcessEvent(commandEvent); - return true; + return true; } #endif // wxUSE_MENUS_NATIVE -// Responds to colour changes, and passes event on to children. -void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) -{ -} - void wxFrame::OnPaint(wxPaintEvent& event) { - #if wxUSE_STATUSBAR - if(StatusBar!=NULL) - StatusBar->DrawStatusBar(); - #endif +#if wxUSE_STATUSBAR + if( m_frameStatusBar ) + m_frameStatusBar->DrawStatusBar(); +#endif // wxUSE_STATUSBAR } - -// Pass TRUE to show full screen, FALSE to restore. + +// Pass true to show full screen, false to restore. bool wxFrame::ShowFullScreen(bool show, long style) { return false; @@ -334,53 +272,6 @@ void wxFrame::IconizeChildFrames(bool bIconize) { } -WXHICON wxFrame::GetDefaultIcon() const -{ - // we don't have any standard icons (any more) - return (WXHICON)0; -} - -// =========================================================================== -// message processing -// =========================================================================== - -// --------------------------------------------------------------------------- -// preprocessing -// --------------------------------------------------------------------------- - -bool wxFrame::MSWTranslateMessage(WXMSG* pMsg) -{ - return false; -} - -// --------------------------------------------------------------------------- -// our private (non virtual) message handlers -// --------------------------------------------------------------------------- - -bool wxFrame::HandlePaint() -{ - return false; -} - -bool wxFrame::HandleSize(int x, int y, WXUINT id) -{ - return false; -} - -bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) -{ - return false; -} - -// --------------------------------------------------------------------------- -// the window proc for wxFrame -// --------------------------------------------------------------------------- - -WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) -{ - return false; -} - // ---------------------------------------------------------------------------- // wxFrame size management: we exclude the areas taken by menu/status/toolbars // from the client area, so the client area is what's really available for the @@ -390,6 +281,17 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara // get the origin of the client area in the client coordinates wxPoint wxFrame::GetClientAreaOrigin() const { - wxPoint pt; - return pt; + // there is no API to get client area but we know + // it starts after titlebar and 1 pixel of form border + Coord maxY = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y), + X = 1, + Y = 0; + while ( Y < maxY ) + { + if(!FrmPointInTitle((FormType*)GetForm(),X,Y)) + return wxPoint(X,Y+1); + Y++; + } + + return wxPoint(X,0); }