]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/deprecated/tbarsmpl.h
97bc158f0f39100b15566212cb051894142228cc
[wxWidgets.git] / contrib / include / wx / deprecated / tbarsmpl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/deprecated/tbarsmpl.h
3 // Purpose: wxToolBarSimple class
4 // Author: Julian Smart
5 // Modified by: VZ on 14.12.99 during wxToolBar classes reorganization
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_TBARSMPLH__
13 #define _WX_TBARSMPLH__
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "tbarsmpl.h"
17 #endif
18
19 #include "wx/tbarbase.h"
20
21 #include "wx/deprecated/setup.h"
22
23 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_SIMPLE
24
25 class WXDLLEXPORT wxMemoryDC;
26
27 // ----------------------------------------------------------------------------
28 // wxToolBarSimple is a generic toolbar implementation in pure wxWidgets
29 // ----------------------------------------------------------------------------
30
31 class WXDLLIMPEXP_DEPRECATED wxToolBarSimple : public wxToolBarBase
32 {
33 public:
34 // ctors and dtor
35 wxToolBarSimple() { Init(); }
36
37 wxToolBarSimple(wxWindow *parent,
38 wxWindowID winid,
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
46 Create(parent, winid, pos, size, style, name);
47 }
48
49 bool Create(wxWindow *parent,
50 wxWindowID winid,
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
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);
105
106 protected:
107 // common part of all ctors
108 void Init();
109
110 // implement base class pure virtuals
111 virtual wxToolBarToolBase *DoAddTool
112 (
113 int toolid,
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,
121 wxCoord xPos = wxDefaultCoord,
122 wxCoord yPos = wxDefaultCoord
123 );
124
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
132 virtual wxToolBarToolBase *CreateTool(int winid,
133 const wxString& label,
134 const wxBitmap& bmpNormal,
135 const wxBitmap& bmpDisabled,
136 wxItemKind kind,
137 wxObject *clientData,
138 const wxString& shortHelp,
139 const wxString& longHelp);
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;
162 int m_xScrollLines;
163 int m_yScrollLines;
164 int m_xScrollLinesPerPage;
165 int m_yScrollLinesPerPage;
166
167 private:
168 DECLARE_EVENT_TABLE()
169 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarSimple)
170 };
171
172 #endif // wxUSE_TOOLBAR_SIMPLE
173
174 #endif
175 // _WX_TBARSMPLH__
176