]>
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 IMPLEMENT_DYNAMIC_CLASS(wxToolBar
, wxToolBarBase
)
21 BEGIN_EVENT_TABLE(wxToolBar
, wxToolBarBase
)
24 wxToolBar::wxToolBar()
33 bool wxToolBar::Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
,
34 long style
, const wxString
& name
)
43 m_windowStyle
= style
;
47 if (parent
) parent
->AddChild(this);
49 // TODO create toolbar
54 wxToolBar::~wxToolBar()
59 bool wxToolBar::CreateTools()
61 if (m_tools
.Number() == 0)
68 void wxToolBar::SetToolBitmapSize(const wxSize
& size
)
70 m_defaultWidth
= size
.x
; m_defaultHeight
= size
.y
;
74 wxSize
wxToolBar::GetMaxSize() const
80 // The button size is bigger than the bitmap size
81 wxSize
wxToolBar::GetToolSize() const
84 return wxSize(m_defaultWidth
+ 8, m_defaultHeight
+ 7);
87 void wxToolBar::EnableTool(int toolIndex
, bool enable
)
89 wxNode
*node
= m_tools
.Find((long)toolIndex
);
92 wxToolBarTool
*tool
= (wxToolBarTool
*)node
->Data();
93 tool
->m_enabled
= enable
;
98 void wxToolBar::ToggleTool(int toolIndex
, bool toggle
)
100 wxNode
*node
= m_tools
.Find((long)toolIndex
);
103 wxToolBarTool
*tool
= (wxToolBarTool
*)node
->Data();
104 if (tool
->m_isToggle
)
106 tool
->m_toggleState
= toggle
;
107 // TODO: set toggle state
112 void wxToolBar::ClearTools()
115 wxToolBarBase::ClearTools();
118 // If pushedBitmap is NULL, a reversed version of bitmap is
119 // created and used as the pushed/toggled image.
120 // If toggle is TRUE, the button toggles between the two states.
122 wxToolBarTool
*wxToolBar::AddTool(int index
, const wxBitmap
& bitmap
, const wxBitmap
& pushedBitmap
,
123 bool toggle
, long xPos
, long yPos
, wxObject
*clientData
, const wxString
& helpString1
, const wxString
& helpString2
)
125 wxToolBarTool
*tool
= new wxToolBarTool(index
, bitmap
, wxNullBitmap
, toggle
, xPos
, yPos
, helpString1
, helpString2
);
126 tool
->m_clientData
= clientData
;
131 tool
->m_x
= m_xMargin
;
136 tool
->m_y
= m_yMargin
;
138 tool
->SetSize(GetDefaultButtonWidth(), GetDefaultButtonHeight());
140 m_tools
.Append((long)index
, tool
);