]>
git.saurik.com Git - wxWidgets.git/blob - src/stubs/toolbar.cpp
61f34c8283ffae66e34e70426988a10fdcc434b0
1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "toolbar.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
27 #include "wx/toolbar.h"
29 #if !USE_SHARED_LIBRARY
30 IMPLEMENT_DYNAMIC_CLASS(wxToolBar
, wxToolBarBase
)
32 BEGIN_EVENT_TABLE(wxToolBar
, wxToolBarBase
)
36 wxToolBar::wxToolBar()
45 bool wxToolBar::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
46 long style
, const wxString
& name
)
55 m_windowStyle
= style
;
59 if (parent
) parent
->AddChild(this);
61 // TODO create toolbar
66 wxToolBar::~wxToolBar()
71 bool wxToolBar::CreateTools()
73 if (m_tools
.Number() == 0)
80 void wxToolBar::SetToolBitmapSize(const wxSize
& size
)
82 m_defaultWidth
= size
.x
; m_defaultHeight
= size
.y
;
86 wxSize
wxToolBar::GetMaxSize() const
92 // The button size is bigger than the bitmap size
93 wxSize
wxToolBar::GetToolSize() const
96 return wxSize(m_defaultWidth
+ 8, m_defaultHeight
+ 7);
99 void wxToolBar::EnableTool(int toolIndex
, bool enable
)
101 wxNode
*node
= m_tools
.Find((long)toolIndex
);
104 wxToolBarTool
*tool
= (wxToolBarTool
*)node
->Data();
105 tool
->m_enabled
= enable
;
106 // TODO enable button
111 void wxToolBar::ToggleTool(int toolIndex
, bool toggle
)
113 wxNode
*node
= m_tools
.Find((long)toolIndex
);
116 wxToolBarTool
*tool
= (wxToolBarTool
*)node
->Data();
117 if (tool
->m_isToggle
)
119 tool
->m_toggleState
= toggle
;
120 // TODO: set toggle state
125 void wxToolBar::ClearTools()
128 wxToolBarBase::ClearTools();
131 // If pushedBitmap is NULL, a reversed version of bitmap is
132 // created and used as the pushed/toggled image.
133 // If toggle is TRUE, the button toggles between the two states.
135 wxToolBarTool
*wxToolBar::AddTool(int index
, const wxBitmap
& bitmap
, const wxBitmap
& pushedBitmap
,
136 bool toggle
, long xPos
, long yPos
, wxObject
*clientData
, const wxString
& helpString1
, const wxString
& helpString2
)
138 wxToolBarTool
*tool
= new wxToolBarTool(index
, bitmap
, (wxBitmap
*)NULL
, toggle
, xPos
, yPos
, helpString1
, helpString2
);
139 tool
->m_clientData
= clientData
;
144 tool
->m_x
= m_xMargin
;
149 tool
->m_y
= m_yMargin
;
151 tool
->SetSize(GetDefaultButtonWidth(), GetDefaultButtonHeight());
153 m_tools
.Append((long)index
, tool
);