X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/771be77f9a134e71facb6611bd490d45cf30b142..abd474ea63667f727940a009cc3e0b23ba9f418f:/src/palmos/statbrpalm.cpp diff --git a/src/palmos/statbrpalm.cpp b/src/palmos/statbrpalm.cpp index ae4b758f3a..ff3ea0af13 100644 --- a/src/palmos/statbrpalm.cpp +++ b/src/palmos/statbrpalm.cpp @@ -1,18 +1,14 @@ /////////////////////////////////////////////////////////////////////////////// -// 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 /////////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "statusbr.h" -#endif - // for compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -20,18 +16,23 @@ #pragma hdrstop #endif +#if wxUSE_NATIVE_STATUSBAR + +#include "wx/statusbr.h" + #ifndef WX_PRECOMP - #include "wx/setup.h" - #include "wx/frame.h" - #include "wx/settings.h" - #include "wx/dcclient.h" + #include "wx/frame.h" + #include "wx/settings.h" + #include "wx/dcclient.h" + #include "wx/intl.h" + #include "wx/log.h" #endif -#if wxUSE_STATUSBAR - -#include "wx/intl.h" -#include "wx/log.h" -#include "wx/statusbr.h" +#ifdef __WXPALMOS6__ + #include +#else + #include +#endif // __WXPALMOS6__ // ---------------------------------------------------------------------------- // macros @@ -48,41 +49,65 @@ wxStatusBarPalm::wxStatusBarPalm() { SetParent(NULL); - m_hWnd = 0; - m_windowId = 0; } 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; SetName(name); SetParent(parent); + SetId( id == wxID_ANY ? NewControlId() : id ); parent->AddChild(this); - m_windowId = id == -1 ? 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 - wxASSERT_MSG( (nFields > 0) && (nFields < 255), _T("too many fields") ); + wxASSERT_MSG( (nFields > 0) && (nFields < 255), wxT("too many fields") ); wxStatusBarBase::SetFieldsCount(nFields, widths); @@ -102,26 +127,15 @@ void wxStatusBarPalm::SetFieldsWidth() DeleteStatusBuffer(); } -void wxStatusBarPalm::SetStatusText(const wxString& strText, int nField) +void wxStatusBarPalm::DoUpdateStatusText(int nField) { - wxCHECK_RET( (nField >= 0) && (nField < m_nFields), - _T("invalid statusbar field index") ); - SetStatusBufferText(strText,nField); DrawStatusBar(); } -wxString wxStatusBarPalm::GetStatusText(int nField) const -{ - wxCHECK_MSG( (nField >= 0) && (nField < m_nFields), wxEmptyString, - _T("invalid statusbar field index") ); - - wxString text; - return text; -} - void wxStatusBarPalm::DrawStatusBar() { +#if 0 int i=0; int leftPos=0; wxArrayInt widthsAbs; @@ -144,6 +158,7 @@ void wxStatusBarPalm::DrawStatusBar() leftPos+=widthsAbs[i]+2; } WinDrawLine(0,160-FntCharHeight()-1,159,160-FntCharHeight()-1); +#endif } void wxStatusBarPalm::SetStatusBufferText(const wxString& text, int number) @@ -159,7 +174,7 @@ wxString wxStatusBarPalm::GetStatusBufferText(int number) { wxListString *st = GetStatusBufferStack(number); if(st==0) - return ""; + return wxEmptyString; wxListString::compatibility_iterator top = st->GetFirst(); return(*top->GetData()); @@ -244,5 +259,4 @@ void wxStatusBarPalm::DoMoveWindow(int x, int y, int width, int height) { } -#endif // wxUSE_STATUSBAR - +#endif // wxUSE_NATIVE_STATUSBAR