]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/deprecated/tbarsmpl.h
Applied patch [ 1117207 ] changed the test for SQL_C_WCHAR
[wxWidgets.git] / contrib / include / wx / deprecated / tbarsmpl.h
CommitLineData
10b959e3 1/////////////////////////////////////////////////////////////////////////////
8a82c9ec 2// Name: wx/deprecated/tbarsmpl.h
10b959e3
JS
3// Purpose: wxToolBarSimple class
4// Author: Julian Smart
8a0681f9 5// Modified by: VZ on 14.12.99 during wxToolBar classes reorganization
10b959e3
JS
6// Created: 01/02/97
7// RCS-ID: $Id$
371a5b4e 8// Copyright: (c) Julian Smart
8a0681f9 9// Licence: wxWindows licence
10b959e3
JS
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_TBARSMPLH__
13#define _WX_TBARSMPLH__
10b959e3 14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
8a0681f9 16 #pragma interface "tbarsmpl.h"
10b959e3
JS
17#endif
18
10b959e3
JS
19#include "wx/tbarbase.h"
20
8a82c9ec
JS
21#include "wx/deprecated/setup.h"
22
3080bf59 23#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_SIMPLE
8a0681f9 24
46ccb510
JS
25class WXDLLEXPORT wxMemoryDC;
26
8a0681f9 27// ----------------------------------------------------------------------------
be5a51fb 28// wxToolBarSimple is a generic toolbar implementation in pure wxWidgets
8a0681f9 29// ----------------------------------------------------------------------------
10b959e3 30
8a82c9ec 31class WXDLLIMPEXP_DEPRECATED wxToolBarSimple : public wxToolBarBase
10b959e3 32{
8a0681f9
VZ
33public:
34 // ctors and dtor
35 wxToolBarSimple() { Init(); }
36
37 wxToolBarSimple(wxWindow *parent,
d9e2e4c2 38 wxWindowID winid,
8a0681f9
VZ
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 long style = wxNO_BORDER | wxTB_HORIZONTAL,
42 const wxString& name = wxToolBarNameStr)
43 {
44 Init();
45
d9e2e4c2 46 Create(parent, winid, pos, size, style, name);
8a0681f9
VZ
47 }
48
49 bool Create(wxWindow *parent,
d9e2e4c2 50 wxWindowID winid,
8a0681f9
VZ
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = wxNO_BORDER | wxTB_HORIZONTAL,
54 const wxString& name = wxToolBarNameStr);
55
56 virtual ~wxToolBarSimple();
57
58 // override/implement base class virtuals
8a0681f9
VZ
59 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
60
61 virtual bool Realize();
62
63 virtual void SetRows(int nRows);
64
65 // implementation from now on
66 // --------------------------
67
68 // SCROLLING: this has to be copied from wxScrolledWindow since
69 // wxToolBarBase inherits from wxControl. This could have been put into
70 // wxToolBarSimple, but we might want any derived toolbar class to be
71 // scrollable.
72
73 // Number of pixels per user unit (0 or -1 for no scrollbar)
74 // Length of virtual canvas in user units
75 virtual void SetScrollbars(int horizontal, int vertical,
76 int x_length, int y_length,
77 int x_pos = 0, int y_pos = 0);
78
79 // Physically scroll the window
80 virtual void Scroll(int x_pos, int y_pos);
81 virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
82 virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
83 virtual void AdjustScrollbars();
84
85 // Prepare the DC by translating it according to the current scroll position
86 virtual void PrepareDC(wxDC& dc);
87
88 int GetScrollPageSize(int orient) const ;
89 void SetScrollPageSize(int orient, int pageSize);
90
91 // Get the view start
92 virtual void ViewStart(int *x, int *y) const;
93
94 // Actual size in pixels when scrolling is taken into account
95 virtual void GetVirtualSize(int *x, int *y) const;
96
97 int CalcScrollInc(wxScrollEvent& event);
98
99 // event handlers
100 void OnPaint(wxPaintEvent& event);
101 void OnSize(wxSizeEvent& event);
102 void OnMouseEvent(wxMouseEvent& event);
103 void OnKillFocus(wxFocusEvent& event);
104 void OnScroll(wxScrollEvent& event);
81d66cf3
JS
105
106protected:
8a0681f9
VZ
107 // common part of all ctors
108 void Init();
109
110 // implement base class pure virtuals
e76c0b5f
VZ
111 virtual wxToolBarToolBase *DoAddTool
112 (
d9e2e4c2 113 int toolid,
e76c0b5f
VZ
114 const wxString& label,
115 const wxBitmap& bitmap,
116 const wxBitmap& bmpDisabled,
117 wxItemKind kind,
118 const wxString& shortHelp = wxEmptyString,
119 const wxString& longHelp = wxEmptyString,
120 wxObject *clientData = NULL,
318c5e9f
WS
121 wxCoord xPos = wxDefaultCoord,
122 wxCoord yPos = wxDefaultCoord
e76c0b5f
VZ
123 );
124
8a0681f9
VZ
125 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
126 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
127
128 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
129 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
130 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
131
d9e2e4c2 132 virtual wxToolBarToolBase *CreateTool(int winid,
e76c0b5f
VZ
133 const wxString& label,
134 const wxBitmap& bmpNormal,
135 const wxBitmap& bmpDisabled,
136 wxItemKind kind,
8a0681f9 137 wxObject *clientData,
e76c0b5f
VZ
138 const wxString& shortHelp,
139 const wxString& longHelp);
8a0681f9
VZ
140 virtual wxToolBarToolBase *CreateTool(wxControl *control);
141
142 // helpers
143 void DrawTool(wxToolBarToolBase *tool);
144 virtual void DrawTool(wxDC& dc, wxToolBarToolBase *tool);
145 virtual void SpringUpButton(int index);
146
147 int m_currentRowsOrColumns;
148
149 int m_pressedTool, m_currentTool;
150
151 wxCoord m_lastX, m_lastY;
152 wxCoord m_maxWidth, m_maxHeight;
153 wxCoord m_xPos, m_yPos;
154
155 // scrolling data
156 int m_xScrollPixelsPerLine;
157 int m_yScrollPixelsPerLine;
158 bool m_xScrollingEnabled;
159 bool m_yScrollingEnabled;
160 int m_xScrollPosition;
161 int m_yScrollPosition;
8a0681f9
VZ
162 int m_xScrollLines;
163 int m_yScrollLines;
164 int m_xScrollLinesPerPage;
165 int m_yScrollLinesPerPage;
166
167private:
168 DECLARE_EVENT_TABLE()
2eb10e2a 169 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarSimple)
10b959e3
JS
170};
171
8a0681f9
VZ
172#endif // wxUSE_TOOLBAR_SIMPLE
173
10b959e3 174#endif
34138703 175 // _WX_TBARSMPLH__
10b959e3 176