]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/buttonbar.cpp
Add backend descriptions for all backends to the documentation.
[wxWidgets.git] / src / generic / buttonbar.cpp
index b03090fb68fbc4c59b62128f3353551296597e26..cf9e0ba75b74d6721e740f24d506dc8e8b05b1bd 100644 (file)
     #include "wx/utils.h"
     #include "wx/app.h"
     #include "wx/log.h"
     #include "wx/utils.h"
     #include "wx/app.h"
     #include "wx/log.h"
+    #include "wx/frame.h"
+    #include "wx/dcclient.h"
+    #include "wx/settings.h"
+    #include "wx/image.h"
 #endif
 
 #endif
 
-#include "wx/frame.h"
-#include "wx/image.h"
-#include "wx/settings.h"
-#include "wx/dcclient.h"
-
 // ----------------------------------------------------------------------------
 // wxButtonToolBarTool: our implementation of wxToolBarToolBase
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // wxButtonToolBarTool: our implementation of wxToolBarToolBase
 // ----------------------------------------------------------------------------
@@ -67,8 +66,10 @@ public:
         m_button = NULL;
     }
 
         m_button = NULL;
     }
 
-    wxButtonToolBarTool(wxButtonToolBar *tbar, wxControl *control)
-        : wxToolBarToolBase(tbar, control)
+    wxButtonToolBarTool(wxButtonToolBar *tbar,
+                        wxControl *control,
+                        const wxString& label)
+        : wxToolBarToolBase(tbar, control, label)
     {
         m_x = m_y = wxDefaultCoord;
         m_width =
     {
         m_x = m_y = wxDefaultCoord;
         m_width =
@@ -206,7 +207,7 @@ void wxButtonToolBar::GetRectLimits(const wxRect& rect,
                               wxCoord *start,
                               wxCoord *end) const
 {
                               wxCoord *start,
                               wxCoord *end) const
 {
-    wxCHECK_RET( start && end, _T("NULL pointer in GetRectLimits") );
+    wxCHECK_RET( start && end, wxT("NULL pointer in GetRectLimits") );
 
     if ( IsVertical() )
     {
 
     if ( IsVertical() )
     {
@@ -225,7 +226,7 @@ void wxButtonToolBar::SetToolShortHelp(int id, const wxString& help)
 {
     wxToolBarToolBase *tool = FindById(id);
 
 {
     wxToolBarToolBase *tool = FindById(id);
 
-    wxCHECK_RET( tool, _T("SetToolShortHelp: no such tool") );
+    wxCHECK_RET( tool, wxT("SetToolShortHelp: no such tool") );
 
     // TODO: set tooltip/short help
     tool->SetShortHelp(help);
 
     // TODO: set tooltip/short help
     tool->SetShortHelp(help);
@@ -272,9 +273,10 @@ wxToolBarToolBase *wxButtonToolBar::CreateTool(int id,
                              clientData, shortHelp, longHelp);
 }
 
                              clientData, shortHelp, longHelp);
 }
 
-wxToolBarToolBase *wxButtonToolBar::CreateTool(wxControl *control)
+wxToolBarToolBase *wxButtonToolBar::CreateTool(wxControl *control,
+                                               const wxString& label)
 {
 {
-    return new wxButtonToolBarTool(this, control);
+    return new wxButtonToolBarTool(this, control, label);
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
@@ -287,7 +289,7 @@ wxRect wxButtonToolBar::GetToolRect(wxToolBarToolBase *toolBase) const
 
     wxRect rect;
 
 
     wxRect rect;
 
-    wxCHECK_MSG( tool, rect, _T("GetToolRect: NULL tool") );
+    wxCHECK_MSG( tool, rect, wxT("GetToolRect: NULL tool") );
 
     // ensure that we always have the valid tool position
     if ( m_needsLayout )
 
     // ensure that we always have the valid tool position
     if ( m_needsLayout )
@@ -352,7 +354,7 @@ bool wxButtonToolBar::Realize()
     m_needsLayout = true;
     DoLayout();
 
     m_needsLayout = true;
     DoLayout();
 
-    SetBestSize(wxSize(m_maxWidth, m_maxHeight));
+    SetInitialSize(wxSize(m_maxWidth, m_maxHeight));
 
     return true;
 }
 
     return true;
 }
@@ -386,7 +388,7 @@ void wxButtonToolBar::DoLayout()
             {
                 wxBitmapButton* bmpButton = new wxBitmapButton(this, tool->GetId(), tool->GetNormalBitmap(), wxPoint(tool->m_x, tool->m_y), wxDefaultSize,
                                                                wxBU_AUTODRAW|wxBORDER_NONE);
             {
                 wxBitmapButton* bmpButton = new wxBitmapButton(this, tool->GetId(), tool->GetNormalBitmap(), wxPoint(tool->m_x, tool->m_y), wxDefaultSize,
                                                                wxBU_AUTODRAW|wxBORDER_NONE);
-                if (!tool->GetShortHelp().IsEmpty())
+                if (!tool->GetShortHelp().empty())
                     bmpButton->SetLabel(tool->GetShortHelp());
 
                 tool->SetButton(bmpButton);
                     bmpButton->SetLabel(tool->GetShortHelp());
 
                 tool->SetButton(bmpButton);
@@ -406,7 +408,7 @@ void wxButtonToolBar::DoLayout()
                 {
                     sz.y += (m_labelHeight + m_labelMargin);
 
                 {
                     sz.y += (m_labelHeight + m_labelMargin);
 
-                    if (!tool->GetShortHelp().IsEmpty())
+                    if (!tool->GetShortHelp().empty())
                     {
                         wxClientDC dc(this);
                         dc.SetFont(GetFont());
                     {
                         wxClientDC dc(this);
                         dc.SetFont(GetFont());
@@ -491,7 +493,7 @@ void wxButtonToolBar::OnCommand(wxCommandEvent& event)
 }
 
 // paints a border
 }
 
 // paints a border
-void wxButtonToolBar::OnPaint(wxPaintEvent& event)
+void wxButtonToolBar::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
 
 {
     wxPaintDC dc(this);
 
@@ -515,7 +517,7 @@ void wxButtonToolBar::OnPaint(wxPaintEvent& event)
             dc.DrawRectangle(backgroundRect);
         }
 
             dc.DrawRectangle(backgroundRect);
         }
 
-        if (m_labelHeight > 0 && !tool->GetShortHelp().IsEmpty())
+        if (m_labelHeight > 0 && !tool->GetShortHelp().empty())
         {
             int tw, th;
             dc.GetTextExtent(tool->GetShortHelp(), & tw, & th);
         {
             int tw, th;
             dc.GetTextExtent(tool->GetShortHelp(), & tw, & th);
@@ -547,7 +549,7 @@ void wxButtonToolBar::OnLeftUp(wxMouseEvent& event)
         {
             wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, tool->GetId());
             event.SetEventObject(tool->GetButton());
         {
             wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, tool->GetId());
             event.SetEventObject(tool->GetButton());
-            if (!ProcessEvent(event))
+            if (!GetEventHandler()->ProcessEvent(event))
                 event.Skip();
         }
     }
                 event.Skip();
         }
     }