From: Włodzimierz Skiba Date: Fri, 21 Jan 2005 11:22:11 +0000 (+0000) Subject: Reenable wxPalmOS status bar after recent changes. Start transition from faked drawin... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b08cd3bf53901e3180e0ee60376807563c828495 Reenable wxPalmOS status bar after recent changes. Start transition from faked drawing of the bar to usage of the native status bar. Source cleaning as usually. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31531 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index 8c7f5f1ea0..5072accba8 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -1015,7 +1015,9 @@ #ifndef wxUSE_NATIVE_STATUSBAR # define wxUSE_NATIVE_STATUSBAR 0 #elif wxUSE_NATIVE_STATUSBAR -# if defined(__WXUNIVERSAL__) || !(defined(__WXMSW__) || defined(__WXMAC__)) +# if defined(__WXUNIVERSAL__) || !( defined(__WXMSW__) || \ + defined(__WXMAC__) || \ + defined(__WXPALMOS__) ) # undef wxUSE_NATIVE_STATUSBAR # define wxUSE_NATIVE_STATUSBAR 0 # endif diff --git a/include/wx/palmos/statusbr.h b/include/wx/palmos/statusbr.h index dade65c243..bcbfedb12c 100644 --- a/include/wx/palmos/statusbr.h +++ b/include/wx/palmos/statusbr.h @@ -24,20 +24,24 @@ public: // ctors and such wxStatusBarPalm(); wxStatusBarPalm(wxWindow *parent, - wxWindowID id = -1, - long style = wxST_SIZEGRIP, - const wxString& name = wxEmptyString) + wxWindowID id = wxID_ANY, + long style = wxST_SIZEGRIP, + const wxString& name = wxEmptyString) { (void)Create(parent, id, style, name); } bool Create(wxWindow *parent, - wxWindowID id = -1, + wxWindowID id = wxID_ANY, long style = wxST_SIZEGRIP, const wxString& name = wxEmptyString); virtual ~wxStatusBarPalm(); + // for native status bar use native check for visibility + virtual bool IsShown() const; + virtual bool Show( bool show = true ); + // a status line can have several (<256) fields numbered from 0 virtual void SetFieldsCount(int number = 1, const int *widths = NULL); diff --git a/include/wx/window.h b/include/wx/window.h index 2fc2a8a6d2..fb7e781ac3 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -452,7 +452,7 @@ public: virtual bool Enable( bool enable = true ); bool Disable() { return Enable(false); } - bool IsShown() const { return m_isShown; } + virtual bool IsShown() const { return m_isShown; } bool IsEnabled() const { return m_isEnabled; } // get/set window style (setting style won't update the window and so diff --git a/src/palmos/statbrpalm.cpp b/src/palmos/statbrpalm.cpp index ae4b758f3a..0b77b5d424 100644 --- a/src/palmos/statbrpalm.cpp +++ b/src/palmos/statbrpalm.cpp @@ -1,11 +1,11 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: palmos/statbrpalm.cpp +// Name: src/palmos/statbrpalm.cpp // Purpose: Implementation of wxStatusBar for PalmOS -// Author: William Osborne -// Modified by: +// Author: William Osborne - minimal working wxPalmOS port +// Modified by: Wlodzimierz ABX Skiba - transition from faked drawing to native statusbar // Created: 10/13/04 -// RCS-ID: $Id: -// Copyright: (c) William Osborne +// RCS-ID: $Id$ +// Copyright: (c) William Osborne, Wlodzimierz Skiba // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -27,7 +27,7 @@ #include "wx/dcclient.h" #endif -#if wxUSE_STATUSBAR +#if wxUSE_NATIVE_STATUSBAR #include "wx/intl.h" #include "wx/log.h" @@ -53,11 +53,11 @@ wxStatusBarPalm::wxStatusBarPalm() } bool wxStatusBarPalm::Create(wxWindow *parent, - wxWindowID id, - long style, - const wxString& name) + wxWindowID id, + long style, + const wxString& name) { - wxCHECK_MSG( parent, FALSE, wxT("status bar must have a parent") ); + wxCHECK_MSG( parent, false, wxT("status bar must have a parent") ); StatusTextBuffer = NULL; @@ -66,19 +66,47 @@ bool wxStatusBarPalm::Create(wxWindow *parent, parent->AddChild(this); - m_windowId = id == -1 ? NewControlId() : id; + m_windowId = id == wxID_ANY ? NewControlId() : id; SetFieldsCount(1); SubclassWin(m_hWnd); - return TRUE; + return true; } wxStatusBarPalm::~wxStatusBarPalm() { + Show(); + DeleteStatusBuffer(); } +bool wxStatusBarPalm::IsShown() const +{ + return StatGetAttribute ( statAttrBarVisible , NULL ); +} + +bool wxStatusBarPalm::Show( bool show ) +{ + if(show) + { + // show it if hidden + if(IsShown()) + return false; + status_t rc = StatShow(); + wxCHECK_MSG( rc == errNone, false, wxT("cannot hide status bar") ); + } + else + { + // hide it if shown + if(!IsShown()) + return false; + status_t rc = StatHide(); + wxCHECK_MSG( rc == errNone, false, wxT("cannot hide status bar") ); + } + return true; +} + void wxStatusBarPalm::SetFieldsCount(int nFields, const int *widths) { // this is a Windows limitation @@ -244,5 +272,5 @@ void wxStatusBarPalm::DoMoveWindow(int x, int y, int width, int height) { } -#endif // wxUSE_STATUSBAR +#endif // wxUSE_NATIVE_STATUSBAR