]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/toolbar.cpp
ignore clicks on a toolbar but outside any button
[wxWidgets.git] / src / motif / toolbar.cpp
index 56529122275fc43083a64104899a1e4f7c939074..a7faa4d42aff45e8224bddc42b4744c2bd0f72ef 100644 (file)
     #pragma implementation "toolbar.h"
 #endif
 
+#ifdef __VMS
+#define XtDisplay XTDISPLAY
+#endif
+
 #include "wx/wx.h"
 #include "wx/app.h"
 #include "wx/timer.h"
@@ -47,7 +51,7 @@
 // ----------------------------------------------------------------------------
 
 #if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
 #endif
 
 // ----------------------------------------------------------------------------
@@ -172,6 +176,12 @@ void wxToolBar::Init()
     m_maxHeight = -1;
     m_defaultWidth = 24;
     m_defaultHeight = 22;
+    m_toolPacking = 2;
+    m_toolSeparation = 8;
+    m_xMargin = 2;
+    m_yMargin = 2;
+    m_maxRows = 100;
+    m_maxCols = 100;
 }
 
 bool wxToolBar::Create(wxWindow *parent,
@@ -186,7 +196,7 @@ bool wxToolBar::Create(wxWindow *parent,
     m_windowId = id;
 
     SetName(name);
-    m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+    m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
     m_foregroundColour = parent->GetForegroundColour();
     m_windowStyle = style;
 
@@ -245,6 +255,7 @@ bool wxToolBar::Realize()
     // Separator spacing
     const int separatorSize = GetToolSeparation(); // 8;
     wxSize margins = GetToolMargins();
+    int packing = GetToolPacking();
     int marginX = margins.x;
     int marginY = margins.y;
 
@@ -267,9 +278,15 @@ bool wxToolBar::Realize()
         switch ( tool->GetStyle() )
         {
             case wxTOOL_STYLE_CONTROL:
-                wxFAIL_MSG( _T("not implemented") );
-                break;
+            {
+                wxControl* control = tool->GetControl();
+                wxSize sz = control->GetSize();
+                wxPoint pos = control->GetPosition();
+                control->Move(currentX, pos.y);
+                currentX += sz.x + packing;
 
+                break;
+            }
             case wxTOOL_STYLE_SEPARATOR:
                 currentX += separatorSize;
                 break;
@@ -435,7 +452,7 @@ bool wxToolBar::Realize()
                                   XmNwidth, &width,
                                   XmNheight, & height,
                                   NULL);
-                    currentX += width + marginX;
+                    currentX += width + packing;
                     buttonHeight = wxMax(buttonHeight, height);
                 }