]> git.saurik.com Git - wxWidgets.git/blobdiff - src/palmos/toolbar.cpp
Committed William Osborne's wxPalmOS port
[wxWidgets.git] / src / palmos / toolbar.cpp
diff --git a/src/palmos/toolbar.cpp b/src/palmos/toolbar.cpp
new file mode 100644 (file)
index 0000000..9720b72
--- /dev/null
@@ -0,0 +1,289 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        palmos/toolbar.cpp
+// Purpose:     wxToolBar
+// Author:      William Osborne
+// Modified by:
+// Created:     10/13/04
+// RCS-ID:      $Id: 
+// Copyright:   (c) William Osborne
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
+    #pragma implementation "toolbar.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+    #include "wx/frame.h"
+    #include "wx/log.h"
+    #include "wx/intl.h"
+    #include "wx/dynarray.h"
+    #include "wx/settings.h"
+    #include "wx/bitmap.h"
+    #include "wx/dcmemory.h"
+    #include "wx/control.h"
+#endif
+
+#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
+
+#include "wx/toolbar.h"
+#include "wx/sysopt.h"
+
+#include "wx/palmos/private.h"
+
+#include "wx/palmos/wrapcctl.h"
+
+#include "wx/app.h"         // for GetComCtl32Version
+
+// ----------------------------------------------------------------------------
+// conditional compilation
+// ----------------------------------------------------------------------------
+
+// wxWidgets previously always considered that toolbar buttons have light grey
+// (0xc0c0c0) background and so ignored any bitmap masks - however, this
+// doesn't work with XPMs which then appear to have black background. To make
+// this work, we must respect the bitmap masks - which we do now. This should
+// be ok in any case, but to restore 100% compatible with the old version
+// behaviour, you can set this to 0.
+#define USE_BITMAP_MASKS 1
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
+// wxWin macros
+// ----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
+
+/*
+    TOOLBAR PROPERTIES
+        tool
+            bitmap
+            bitmap2
+            tooltip
+            longhelp
+            radio (bool)
+            toggle (bool)
+        separator
+        style ( wxNO_BORDER | wxTB_HORIZONTAL)
+        bitmapsize
+        margins
+        packing
+        separation
+
+        dontattachtoframe
+*/
+
+BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
+    EVT_MOUSE_EVENTS(wxToolBar::OnMouseEvent)
+    EVT_SYS_COLOUR_CHANGED(wxToolBar::OnSysColourChanged)
+END_EVENT_TABLE()
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+class wxToolBarTool : public wxToolBarToolBase
+{
+public:
+    wxToolBarTool(wxToolBar *tbar,
+                  int id,
+                  const wxString& label,
+                  const wxBitmap& bmpNormal,
+                  const wxBitmap& bmpDisabled,
+                  wxItemKind kind,
+                  wxObject *clientData,
+                  const wxString& shortHelp,
+                  const wxString& longHelp)
+        : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
+                            clientData, shortHelp, longHelp)
+    {
+    }
+
+    wxToolBarTool(wxToolBar *tbar, wxControl *control)
+        : wxToolBarToolBase(tbar, control)
+    {
+    }
+
+    virtual void SetLabel(const wxString& label)
+    {
+    }
+
+    // set/get the number of separators which we use to cover the space used by
+    // a control in the toolbar
+    void SetSeparatorsCount(size_t count) { m_nSepCount = count; }
+    size_t GetSeparatorsCount() const { return m_nSepCount; }
+
+private:
+    size_t m_nSepCount;
+
+    DECLARE_NO_COPY_CLASS(wxToolBarTool)
+};
+
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxToolBarTool
+// ----------------------------------------------------------------------------
+
+wxToolBarToolBase *wxToolBar::CreateTool(int id,
+                                         const wxString& label,
+                                         const wxBitmap& bmpNormal,
+                                         const wxBitmap& bmpDisabled,
+                                         wxItemKind kind,
+                                         wxObject *clientData,
+                                         const wxString& shortHelp,
+                                         const wxString& longHelp)
+{
+    return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind,
+                             clientData, shortHelp, longHelp);
+}
+
+wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
+{
+    return new wxToolBarTool(this, control);
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar construction
+// ----------------------------------------------------------------------------
+
+void wxToolBar::Init()
+{
+}
+
+bool wxToolBar::Create(wxWindow *parent,
+                       wxWindowID id,
+                       const wxPoint& pos,
+                       const wxSize& size,
+                       long style,
+                       const wxString& name)
+{
+    return false;
+}
+
+void wxToolBar::Recreate()
+{
+}
+
+wxToolBar::~wxToolBar()
+{
+}
+
+wxSize wxToolBar::DoGetBestSize() const
+{
+    return wxSize(0,0);
+}
+
+// ----------------------------------------------------------------------------
+// adding/removing tools
+// ----------------------------------------------------------------------------
+
+bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
+{
+    return false;
+}
+
+bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
+{
+    return false;
+}
+
+bool wxToolBar::Realize()
+{
+    return false;
+}
+
+// ----------------------------------------------------------------------------
+// toolbar geometry
+// ----------------------------------------------------------------------------
+
+void wxToolBar::SetToolBitmapSize(const wxSize& size)
+{
+}
+
+void wxToolBar::SetRows(int nRows)
+{
+}
+
+// The button size is bigger than the bitmap size
+wxSize wxToolBar::GetToolSize() const
+{
+    return wxSize(0,0);
+}
+
+static
+wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools,
+                                               size_t index )
+{
+    return 0;
+}
+
+wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
+{
+    return NULL;
+}
+
+void wxToolBar::UpdateSize()
+{
+}
+
+// ----------------------------------------------------------------------------
+// toolbar styles
+// ---------------------------------------------------------------------------
+
+void wxToolBar::SetWindowStyleFlag(long style)
+{
+}
+
+// ----------------------------------------------------------------------------
+// tool state
+// ----------------------------------------------------------------------------
+
+void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable)
+{
+}
+
+void wxToolBar::DoToggleTool(wxToolBarToolBase *tool, bool toggle)
+{
+}
+
+void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))
+{
+}
+
+// ----------------------------------------------------------------------------
+// event handlers
+// ----------------------------------------------------------------------------
+
+// Responds to colour changes, and passes event on to children.
+void wxToolBar::OnSysColourChanged(wxSysColourChangedEvent& event)
+{
+}
+
+void wxToolBar::OnMouseEvent(wxMouseEvent& event)
+{
+}
+
+#endif // wxUSE_TOOLBAR
+