]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/toolbar.cpp
fixed child windows scrolling to use wxSIZE_ALLOW_MINUS_ONE
[wxWidgets.git] / src / motif / toolbar.cpp
index 61640318f537370eb64c5bf0de86f7a1ff8f94a6..42851b1b386c4d5f84087b5ae68b04c45cdd43c9 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        motif/toolbar.cpp
+// Name:        src/motif/toolbar.cpp
 // Purpose:     wxToolBar
 // Author:      Julian Smart
 // Modified by: 13.12.99 by VZ during toolbar classes reorganization
 // Purpose:     wxToolBar
 // Author:      Julian Smart
 // Modified by: 13.12.99 by VZ during toolbar classes reorganization
 // headers
 // ----------------------------------------------------------------------------
 
 // 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"
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #define XtDisplay XTDISPLAY
 #endif
 
 #define XtDisplay XTDISPLAY
 #endif
 
-#include "wx/settings.h"
-#include "wx/app.h"
-#include "wx/timer.h"
 #include "wx/toolbar.h"
 #include "wx/toolbar.h"
-#include "wx/frame.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+    #include "wx/frame.h"
+    #include "wx/timer.h"
+    #include "wx/settings.h"
+#endif
 
 #ifdef __VMS__
 #pragma message disable nosimpint
 
 #ifdef __VMS__
 #pragma message disable nosimpint
@@ -205,6 +204,8 @@ bool wxToolBar::Create(wxWindow *parent,
                                    wxDefaultValidator, name ) )
         return false;
 
                                    wxDefaultValidator, name ) )
         return false;
 
+    FixupStyle();
+
     m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
 
     Widget parentWidget = (Widget) parent->GetClientWidget();
     m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
 
     Widget parentWidget = (Widget) parent->GetClientWidget();
@@ -276,8 +277,6 @@ bool wxToolBar::Realize()
 
     int buttonHeight = 0, buttonWidth = 0;
 
 
     int buttonHeight = 0, buttonWidth = 0;
 
-    int currentSpacing = 0;
-
     Widget button;
     Pixmap pixmap, insensPixmap;
     wxBitmap bmp, insensBmp;
     Widget button;
     Pixmap pixmap, insensPixmap;
     wxBitmap bmp, insensBmp;
@@ -382,7 +381,7 @@ bool wxToolBar::Realize()
                 insensBmp = tool->GetDisabledBitmap();
                 if ( bmp.GetMask() || insensBmp.GetMask() )
                 {
                 insensBmp = tool->GetDisabledBitmap();
                 if ( bmp.GetMask() || insensBmp.GetMask() )
                 {
-                    int backgroundPixel;
+                    WXPixel backgroundPixel;
                     XtVaGetValues(button, XmNbackground, &backgroundPixel,
                                   NULL);
 
                     XtVaGetValues(button, XmNbackground, &backgroundPixel,
                                   NULL);
 
@@ -405,7 +404,7 @@ bool wxToolBar::Realize()
                 // Create a selected/toggled bitmap. If there isn't a 2nd
                 // bitmap, we need to create it (with a darker, selected
                 // background)
                 // Create a selected/toggled bitmap. If there isn't a 2nd
                 // bitmap, we need to create it (with a darker, selected
                 // background)
-                int backgroundPixel;
+                WXPixel backgroundPixel;
                 if ( tool->CanBeToggled() )
                     XtVaGetValues(button, XmNselectColor, &backgroundPixel,
                                   NULL);
                 if ( tool->CanBeToggled() )
                     XtVaGetValues(button, XmNselectColor, &backgroundPixel,
                                   NULL);
@@ -423,7 +422,7 @@ bool wxToolBar::Realize()
                             (Pixmap)tmp.GetDrawable() :
                             tool->GetInsensPixmap();
                 }
                             (Pixmap)tmp.GetDrawable() :
                             tool->GetInsensPixmap();
                 }
-                
+
                 if (tool->CanBeToggled())
                 {
                     // Toggle button
                 if (tool->CanBeToggled())
                 {
                     // Toggle button
@@ -470,7 +469,6 @@ bool wxToolBar::Realize()
                 XtAddEventHandler (button, EnterWindowMask | LeaveWindowMask,
                         False, wxToolButtonPopupCallback, (XtPointer) this);
 
                 XtAddEventHandler (button, EnterWindowMask | LeaveWindowMask,
                         False, wxToolButtonPopupCallback, (XtPointer) this);
 
-                currentSpacing = 0;
                 break;
         }
 
                 break;
         }
 
@@ -499,7 +497,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
     return true;
 }
 
     return true;
 }
 
-bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
+bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
 {
     tool->Detach();
 
 {
     tool->Detach();
 
@@ -523,7 +521,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
                 offset = isVertical ? size.y : size.x;
                 offset += packing;
                 break;
                 offset = isVertical ? size.y : size.x;
                 offset += packing;
                 break;
-            }       
+            }
             case wxTOOL_STYLE_SEPARATOR:
                 offset = isVertical ? 0 : separatorSize;
                 break;
             case wxTOOL_STYLE_SEPARATOR:
                 offset = isVertical ? 0 : separatorSize;
                 break;
@@ -549,14 +547,14 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
             {
             case wxTOOL_STYLE_CONTROL:
             {
             {
             case wxTOOL_STYLE_CONTROL:
             {
-                wxPoint pos = t->GetControl()->GetPosition();
+                wxPoint location = t->GetControl()->GetPosition();
 
                 if( isVertical )
 
                 if( isVertical )
-                    pos.y -= offset;
+                    location.y -= offset;
                 else
                 else
-                    pos.x -= offset;
+                    location.x -= offset;
 
 
-                t->GetControl()->Move( pos );
+                t->GetControl()->Move( location );
                 break;
             }
             case wxTOOL_STYLE_SEPARATOR:
                 break;
             }
             case wxTOOL_STYLE_SEPARATOR:
@@ -570,9 +568,9 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
                                NULL );
 
                 if( isVertical )
                                NULL );
 
                 if( isVertical )
-                    y -= offset;
+                    y = (Dimension)(y - offset);
                 else
                 else
-                    x -= offset;
+                    x = (Dimension)(x - offset);
 
                 XtVaSetValues( t->GetButtonWidget(),
                                XmNx, x,
 
                 XtVaSetValues( t->GetButtonWidget(),
                                XmNx, x,
@@ -628,12 +626,12 @@ void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags)
     }
 
     wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags);
     }
 
     wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags);
-  
+
     // We must refresh the frame size when the toolbar changes size
     // otherwise the toolbar can be shown incorrectly
     if ( old_width != width || old_height != height )
     {
     // We must refresh the frame size when the toolbar changes size
     // otherwise the toolbar can be shown incorrectly
     if ( old_width != width || old_height != height )
     {
-        // But before we send the size event check it 
+        // But before we send the size event check it
         // we have a frame that is not being deleted.
         wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
         if ( frame && !frame->IsBeingDeleted() )
         // we have a frame that is not being deleted.
         wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
         if ( frame && !frame->IsBeingDeleted() )
@@ -761,7 +759,7 @@ void wxToolBarTimer::Notify()
 
         // Move the tooltip more or less above the button
         int yOffset = 20; // TODO: What should be really?
 
         // Move the tooltip more or less above the button
         int yOffset = 20; // TODO: What should be really?
-        y -= yOffset;
+        y = (Position)(y - yOffset);
         if (y < yOffset) y = 0;
 
         /************************************************************/
         if (y < yOffset) y = 0;
 
         /************************************************************/
@@ -793,4 +791,3 @@ void wxToolBarTimer::Notify()
         /************************************************************/
         XtPopup (help_popup, XtGrabNone);
 }
         /************************************************************/
         XtPopup (help_popup, XtGrabNone);
 }
-