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