]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/stubs/toolbar.cpp
fix for assert when setting tooltip for a readonly combo
[wxWidgets.git] / src / stubs / toolbar.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: toolbar.cpp
3// Purpose: wxToolBar
4// Author: AUTHOR
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "toolbar.h"
14#endif
15
16#include "wx/wx.h"
17#include "wx/toolbar.h"
18
19IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
20
21BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
22END_EVENT_TABLE()
23
24wxToolBar::wxToolBar()
25{
26 m_maxWidth = -1;
27 m_maxHeight = -1;
28 m_defaultWidth = 24;
29 m_defaultHeight = 22;
30 // TODO
31}
32
33bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
34 long style, const wxString& name)
35{
36 m_maxWidth = -1;
37 m_maxHeight = -1;
38
39 m_defaultWidth = 24;
40 m_defaultHeight = 22;
41 SetName(name);
42
43 m_windowStyle = style;
44
45 SetParent(parent);
46
47 if (parent) parent->AddChild(this);
48
49 // TODO create toolbar
50
51 return FALSE;
52}
53
54wxToolBar::~wxToolBar()
55{
56 // TODO
57}
58
59bool wxToolBar::CreateTools()
60{
61 if (m_tools.Number() == 0)
62 return FALSE;
63
64 // TODO
65 return FALSE;
66}
67
68void wxToolBar::SetToolBitmapSize(const wxSize& size)
69{
70 m_defaultWidth = size.x; m_defaultHeight = size.y;
71 // TODO
72}
73
74wxSize wxToolBar::GetMaxSize() const
75{
76 // TODO
77 return wxSize(0, 0);
78}
79
80// The button size is bigger than the bitmap size
81wxSize wxToolBar::GetToolSize() const
82{
83 // TODO
84 return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
85}
86
87void wxToolBar::EnableTool(int toolIndex, bool enable)
88{
89 wxNode *node = m_tools.Find((long)toolIndex);
90 if (node)
91 {
92 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
93 tool->m_enabled = enable;
94 // TODO enable button
95 }
96}
97
98void wxToolBar::ToggleTool(int toolIndex, bool toggle)
99{
100 wxNode *node = m_tools.Find((long)toolIndex);
101 if (node)
102 {
103 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
104 if (tool->m_isToggle)
105 {
106 tool->m_toggleState = toggle;
107 // TODO: set toggle state
108 }
109 }
110}
111
112void wxToolBar::ClearTools()
113{
114 // TODO
115 wxToolBarBase::ClearTools();
116}
117
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.
121
122wxToolBarTool *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)
124{
125 wxToolBarTool *tool = new wxToolBarTool(index, bitmap, wxNullBitmap, toggle, xPos, yPos, helpString1, helpString2);
126 tool->m_clientData = clientData;
127
128 if (xPos > -1)
129 tool->m_x = xPos;
130 else
131 tool->m_x = m_xMargin;
132
133 if (yPos > -1)
134 tool->m_y = yPos;
135 else
136 tool->m_y = m_yMargin;
137
138 tool->SetSize(GetDefaultButtonWidth(), GetDefaultButtonHeight());
139
140 m_tools.Append((long)index, tool);
141 return tool;
142}
143