]>
git.saurik.com Git - wxWidgets.git/blob - src/stubs/toolbar.cpp
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "toolbar.h"
17 #include "wx/toolbar.h"
19 #if !USE_SHARED_LIBRARY
20 IMPLEMENT_DYNAMIC_CLASS(wxToolBar
, wxToolBarBase
)
22 BEGIN_EVENT_TABLE(wxToolBar
, wxToolBarBase
)
26 wxToolBar::wxToolBar()
35 bool wxToolBar::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
36 long style
, const wxString
& name
)
45 m_windowStyle
= style
;
49 if (parent
) parent
->AddChild(this);
51 // TODO create toolbar
56 wxToolBar::~wxToolBar()
61 bool wxToolBar::CreateTools()
63 if (m_tools
.Number() == 0)
70 void wxToolBar::SetToolBitmapSize(const wxSize
& size
)
72 m_defaultWidth
= size
.x
; m_defaultHeight
= size
.y
;
76 wxSize
wxToolBar::GetMaxSize() const
82 // The button size is bigger than the bitmap size
83 wxSize
wxToolBar::GetToolSize() const
86 return wxSize(m_defaultWidth
+ 8, m_defaultHeight
+ 7);
89 void wxToolBar::EnableTool(int toolIndex
, bool enable
)
91 wxNode
*node
= m_tools
.Find((long)toolIndex
);
94 wxToolBarTool
*tool
= (wxToolBarTool
*)node
->Data();
95 tool
->m_enabled
= enable
;
100 void wxToolBar::ToggleTool(int toolIndex
, bool toggle
)
102 wxNode
*node
= m_tools
.Find((long)toolIndex
);
105 wxToolBarTool
*tool
= (wxToolBarTool
*)node
->Data();
106 if (tool
->m_isToggle
)
108 tool
->m_toggleState
= toggle
;
109 // TODO: set toggle state
114 void wxToolBar::ClearTools()
117 wxToolBarBase::ClearTools();
120 // If pushedBitmap is NULL, a reversed version of bitmap is
121 // created and used as the pushed/toggled image.
122 // If toggle is TRUE, the button toggles between the two states.
124 wxToolBarTool
*wxToolBar::AddTool(int index
, const wxBitmap
& bitmap
, const wxBitmap
& pushedBitmap
,
125 bool toggle
, long xPos
, long yPos
, wxObject
*clientData
, const wxString
& helpString1
, const wxString
& helpString2
)
127 wxToolBarTool
*tool
= new wxToolBarTool(index
, bitmap
, (wxBitmap
*)NULL
, toggle
, xPos
, yPos
, helpString1
, helpString2
);
128 tool
->m_clientData
= clientData
;
133 tool
->m_x
= m_xMargin
;
138 tool
->m_y
= m_yMargin
;
140 tool
->SetSize(GetDefaultButtonWidth(), GetDefaultButtonHeight());
142 m_tools
.Append((long)index
, tool
);