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 #include "wx/tbarbase.h"
17 #include "wx/deprecated/setup.h"
19 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_SIMPLE
21 class WXDLLEXPORT wxMemoryDC
;
23 // ----------------------------------------------------------------------------
24 // wxToolBarSimple is a generic toolbar implementation in pure wxWidgets
25 // ----------------------------------------------------------------------------
27 class WXDLLIMPEXP_DEPRECATED wxToolBarSimple
: public wxToolBarBase
31 wxToolBarSimple() { Init(); }
33 wxToolBarSimple(wxWindow
*parent
,
35 const wxPoint
& pos
= wxDefaultPosition
,
36 const wxSize
& size
= wxDefaultSize
,
37 long style
= wxNO_BORDER
| wxTB_HORIZONTAL
,
38 const wxString
& name
= wxToolBarNameStr
)
42 Create(parent
, winid
, pos
, size
, style
, name
);
45 bool Create(wxWindow
*parent
,
47 const wxPoint
& pos
= wxDefaultPosition
,
48 const wxSize
& size
= wxDefaultSize
,
49 long style
= wxNO_BORDER
| wxTB_HORIZONTAL
,
50 const wxString
& name
= wxToolBarNameStr
);
52 virtual ~wxToolBarSimple();
54 // override/implement base class virtuals
55 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
57 virtual bool Realize();
59 virtual void SetRows(int nRows
);
61 // implementation from now on
62 // --------------------------
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
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);
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();
81 // Prepare the DC by translating it according to the current scroll position
82 virtual void PrepareDC(wxDC
& dc
);
84 int GetScrollPageSize(int orient
) const ;
85 void SetScrollPageSize(int orient
, int pageSize
);
88 virtual void ViewStart(int *x
, int *y
) const;
90 // Actual size in pixels when scrolling is taken into account
91 virtual void GetVirtualSize(int *x
, int *y
) const;
93 int CalcScrollInc(wxScrollEvent
& event
);
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
);
103 // common part of all ctors
106 // implement base class pure virtuals
107 virtual wxToolBarToolBase
*DoAddTool
110 const wxString
& label
,
111 const wxBitmap
& bitmap
,
112 const wxBitmap
& bmpDisabled
,
114 const wxString
& shortHelp
= wxEmptyString
,
115 const wxString
& longHelp
= wxEmptyString
,
116 wxObject
*clientData
= NULL
,
117 wxCoord xPos
= wxDefaultCoord
,
118 wxCoord yPos
= wxDefaultCoord
121 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
122 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
124 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
125 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
126 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
128 virtual wxToolBarToolBase
*CreateTool(int winid
,
129 const wxString
& label
,
130 const wxBitmap
& bmpNormal
,
131 const wxBitmap
& bmpDisabled
,
133 wxObject
*clientData
,
134 const wxString
& shortHelp
,
135 const wxString
& longHelp
);
136 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
);
139 void DrawTool(wxToolBarToolBase
*tool
);
140 virtual void DrawTool(wxDC
& dc
, wxToolBarToolBase
*tool
);
141 virtual void SpringUpButton(int index
);
143 int m_currentRowsOrColumns
;
145 int m_pressedTool
, m_currentTool
;
147 wxCoord m_lastX
, m_lastY
;
148 wxCoord m_maxWidth
, m_maxHeight
;
149 wxCoord m_xPos
, m_yPos
;
152 int m_xScrollPixelsPerLine
;
153 int m_yScrollPixelsPerLine
;
154 bool m_xScrollingEnabled
;
155 bool m_yScrollingEnabled
;
156 int m_xScrollPosition
;
157 int m_yScrollPosition
;
160 int m_xScrollLinesPerPage
;
161 int m_yScrollLinesPerPage
;
164 DECLARE_EVENT_TABLE()
165 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarSimple
)
168 #endif // wxUSE_TOOLBAR_SIMPLE