]> git.saurik.com Git - wxWidgets.git/commitdiff
Reenable wxPalmOS status bar after recent changes. Start transition from faked drawin...
authorWłodzimierz Skiba <abx@abx.art.pl>
Fri, 21 Jan 2005 11:22:11 +0000 (11:22 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Fri, 21 Jan 2005 11:22:11 +0000 (11:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31531 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/chkconf.h
include/wx/palmos/statusbr.h
include/wx/window.h
src/palmos/statbrpalm.cpp

index 8c7f5f1ea05e96a8933342a6f7d6cde5631b9d5e..5072accba8653325fc3099f48f550db9ee3befb8 100644 (file)
 #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
index dade65c243d42106ece9c0c929fbf7cf6a900eca..bcbfedb12c202f14eda7693c4aa0ac4732354614 100644 (file)
@@ -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);
 
index 2fc2a8a6d2b861d07bd311ad9563ae25f8106e51..fb7e781ac3f50279a48b36f85b3a24080bc060a4 100644 (file)
@@ -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
index ae4b758f3aad8ccfd1502cecb4d4c16f3b35908c..0b77b5d42471800fc3d99cfdff84c6bed4d3c20e 100644 (file)
@@ -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