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
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TBARSMPLH__
13 #define _WX_TBARSMPLH__
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "tbarsmpl.h"
19 #include "wx/tbarbase.h"
21 #include "wx/deprecated/setup.h"
23 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_SIMPLE
25 class WXDLLEXPORT wxMemoryDC
;
27 // ----------------------------------------------------------------------------
28 // wxToolBarSimple is a generic toolbar implementation in pure wxWidgets
29 // ----------------------------------------------------------------------------
31 class WXDLLIMPEXP_DEPRECATED wxToolBarSimple
: public wxToolBarBase
35 wxToolBarSimple() { Init(); }
37 wxToolBarSimple(wxWindow
*parent
,
39 const wxPoint
& pos
= wxDefaultPosition
,
40 const wxSize
& size
= wxDefaultSize
,
41 long style
= wxNO_BORDER
| wxTB_HORIZONTAL
,
42 const wxString
& name
= wxToolBarNameStr
)
46 Create(parent
, winid
, pos
, size
, style
, name
);
49 bool Create(wxWindow
*parent
,
51 const wxPoint
& pos
= wxDefaultPosition
,
52 const wxSize
& size
= wxDefaultSize
,
53 long style
= wxNO_BORDER
| wxTB_HORIZONTAL
,
54 const wxString
& name
= wxToolBarNameStr
);
56 virtual ~wxToolBarSimple();
58 // override/implement base class virtuals
59 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
61 virtual bool Realize();
63 virtual void SetRows(int nRows
);
65 // implementation from now on
66 // --------------------------
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
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);
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();
85 // Prepare the DC by translating it according to the current scroll position
86 virtual void PrepareDC(wxDC
& dc
);
88 int GetScrollPageSize(int orient
) const ;
89 void SetScrollPageSize(int orient
, int pageSize
);
92 virtual void ViewStart(int *x
, int *y
) const;
94 // Actual size in pixels when scrolling is taken into account
95 virtual void GetVirtualSize(int *x
, int *y
) const;
97 int CalcScrollInc(wxScrollEvent
& event
);
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
);
107 // common part of all ctors
110 // implement base class pure virtuals
111 virtual wxToolBarToolBase
*DoAddTool
114 const wxString
& label
,
115 const wxBitmap
& bitmap
,
116 const wxBitmap
& bmpDisabled
,
118 const wxString
& shortHelp
= wxEmptyString
,
119 const wxString
& longHelp
= wxEmptyString
,
120 wxObject
*clientData
= NULL
,
121 wxCoord xPos
= wxDefaultCoord
,
122 wxCoord yPos
= wxDefaultCoord
125 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
126 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
128 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
129 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
130 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
132 virtual wxToolBarToolBase
*CreateTool(int winid
,
133 const wxString
& label
,
134 const wxBitmap
& bmpNormal
,
135 const wxBitmap
& bmpDisabled
,
137 wxObject
*clientData
,
138 const wxString
& shortHelp
,
139 const wxString
& longHelp
);
140 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
);
143 void DrawTool(wxToolBarToolBase
*tool
);
144 virtual void DrawTool(wxDC
& dc
, wxToolBarToolBase
*tool
);
145 virtual void SpringUpButton(int index
);
147 int m_currentRowsOrColumns
;
149 int m_pressedTool
, m_currentTool
;
151 wxCoord m_lastX
, m_lastY
;
152 wxCoord m_maxWidth
, m_maxHeight
;
153 wxCoord m_xPos
, m_yPos
;
156 int m_xScrollPixelsPerLine
;
157 int m_yScrollPixelsPerLine
;
158 bool m_xScrollingEnabled
;
159 bool m_yScrollingEnabled
;
160 int m_xScrollPosition
;
161 int m_yScrollPosition
;
164 int m_xScrollLinesPerPage
;
165 int m_yScrollLinesPerPage
;
168 DECLARE_EVENT_TABLE()
169 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarSimple
)
172 #endif // wxUSE_TOOLBAR_SIMPLE