]> git.saurik.com Git - wxWidgets.git/blame_incremental - contrib/include/wx/deprecated/tbarsmpl.h
don't wake up on Windows messages when waiting for thread termination in a console...
[wxWidgets.git] / contrib / include / wx / deprecated / tbarsmpl.h
... / ...
CommitLineData
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#include "wx/tbarbase.h"
16
17#include "wx/deprecated/setup.h"
18
19#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_SIMPLE
20
21class WXDLLEXPORT wxMemoryDC;
22
23// ----------------------------------------------------------------------------
24// wxToolBarSimple is a generic toolbar implementation in pure wxWidgets
25// ----------------------------------------------------------------------------
26
27class WXDLLIMPEXP_DEPRECATED wxToolBarSimple : public wxToolBarBase
28{
29public:
30 // ctors and dtor
31 wxToolBarSimple() { Init(); }
32
33 wxToolBarSimple(wxWindow *parent,
34 wxWindowID winid,
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
42 Create(parent, winid, pos, size, style, name);
43 }
44
45 bool Create(wxWindow *parent,
46 wxWindowID winid,
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
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);
101
102protected:
103 // common part of all ctors
104 void Init();
105
106 // implement base class pure virtuals
107 virtual wxToolBarToolBase *DoAddTool
108 (
109 int toolid,
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,
117 wxCoord xPos = wxDefaultCoord,
118 wxCoord yPos = wxDefaultCoord
119 );
120
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
128 virtual wxToolBarToolBase *CreateTool(int winid,
129 const wxString& label,
130 const wxBitmap& bmpNormal,
131 const wxBitmap& bmpDisabled,
132 wxItemKind kind,
133 wxObject *clientData,
134 const wxString& shortHelp,
135 const wxString& longHelp);
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;
158 int m_xScrollLines;
159 int m_yScrollLines;
160 int m_xScrollLinesPerPage;
161 int m_yScrollLinesPerPage;
162
163private:
164 DECLARE_EVENT_TABLE()
165 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarSimple)
166};
167
168#endif // wxUSE_TOOLBAR_SIMPLE
169
170#endif
171 // _WX_TBARSMPLH__
172