]>
Commit | Line | Data |
---|---|---|
1e6feb95 | 1 | ///////////////////////////////////////////////////////////////////////////// |
233f5738 | 2 | // Name: wx/scrolwin.h |
1e6feb95 VZ |
3 | // Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 30.08.00 | |
1e6feb95 | 7 | // Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> |
65571936 | 8 | // Licence: wxWindows licence |
1e6feb95 VZ |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
34138703 JS |
11 | #ifndef _WX_SCROLWIN_H_BASE_ |
12 | #define _WX_SCROLWIN_H_BASE_ | |
c801d85f | 13 | |
2cd354c9 | 14 | #include "wx/panel.h" |
1e6feb95 | 15 | |
b5dbe15d | 16 | class WXDLLIMPEXP_FWD_CORE wxScrollHelperEvtHandler; |
4f7d425f | 17 | class WXDLLIMPEXP_FWD_BASE wxTimer; |
1e6feb95 | 18 | |
d32e78bd VZ |
19 | // default scrolled window style: scroll in both directions |
20 | #define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL) | |
21 | ||
6362d82b VZ |
22 | // values for the second argument of wxScrollHelper::ShowScrollbars() |
23 | enum wxScrollbarVisibility | |
24 | { | |
25 | wxSHOW_SB_NEVER = -1, // never show the scrollbar at all | |
26 | wxSHOW_SB_DEFAULT, // show scrollbar only if it is needed | |
27 | wxSHOW_SB_ALWAYS // always show scrollbar, even if not needed | |
28 | }; | |
29 | ||
1e6feb95 | 30 | // ---------------------------------------------------------------------------- |
d32e78bd VZ |
31 | // The hierarchy of scrolling classes is a bit complicated because we want to |
32 | // put as much functionality as possible in a mix-in class not deriving from | |
33 | // wxWindow so that other classes could derive from the same base class on all | |
34 | // platforms irrespectively of whether they are native controls (and hence | |
35 | // don't use our scrolling) or not. | |
36 | // | |
37 | // So we have | |
38 | // | |
010d821b VZ |
39 | // wxAnyScrollHelperBase |
40 | // | | |
41 | // | | |
42 | // \|/ | |
29e1398f | 43 | // wxScrollHelperBase |
d32e78bd VZ |
44 | // | |
45 | // | | |
46 | // \|/ | |
29e1398f | 47 | // wxWindow wxScrollHelper |
d32e78bd VZ |
48 | // | \ / / |
49 | // | \ / / | |
50 | // | _| |_ / | |
51 | // | wxScrolledWindow / | |
52 | // | / | |
53 | // \|/ / | |
54 | // wxControl / | |
55 | // \ / | |
56 | // \ / | |
57 | // _| |_ | |
58 | // wxScrolledControl | |
59 | // | |
1e6feb95 VZ |
60 | // ---------------------------------------------------------------------------- |
61 | ||
010d821b VZ |
62 | // This class allows reusing some of wxScrollHelperBase functionality in |
63 | // wxVarScrollHelperBase in wx/vscroll.h without duplicating its code. | |
64 | class WXDLLIMPEXP_CORE wxAnyScrollHelperBase | |
65 | { | |
66 | public: | |
67 | wxEXPLICIT wxAnyScrollHelperBase(wxWindow* win); | |
0d1903db | 68 | virtual ~wxAnyScrollHelperBase() {} |
010d821b | 69 | |
47062523 VZ |
70 | // Disable use of keyboard keys for scrolling. By default cursor movement |
71 | // keys (including Home, End, Page Up and Down) are used to scroll the | |
72 | // window appropriately. If the derived class uses these keys for something | |
73 | // else, e.g. changing the currently selected item, this function can be | |
74 | // used to disable this behaviour as it's not only not necessary then but | |
75 | // can actually be actively harmful if another object forwards a keyboard | |
76 | // event corresponding to one of the above keys to us using | |
77 | // ProcessWindowEvent() because the event will always be processed which | |
78 | // can be undesirable. | |
79 | void DisableKeyboardScrolling() { m_kbdScrollingEnabled = false; } | |
80 | ||
dc251365 VZ |
81 | // Override this function to draw the graphic (or just process EVT_PAINT) |
82 | virtual void OnDraw(wxDC& WXUNUSED(dc)) { } | |
83 | ||
84 | // change the DC origin according to the scroll position. | |
85 | virtual void DoPrepareDC(wxDC& dc) = 0; | |
86 | ||
010d821b VZ |
87 | // Simple accessor for the window that is really being scrolled. |
88 | wxWindow *GetTargetWindow() const { return m_targetWindow; } | |
89 | ||
dc251365 VZ |
90 | |
91 | // The methods called from the window event handlers. | |
47062523 | 92 | void HandleOnChar(wxKeyEvent& event); |
dc251365 VZ |
93 | void HandleOnPaint(wxPaintEvent& event); |
94 | ||
010d821b VZ |
95 | protected: |
96 | // the window that receives the scroll events and the window to actually | |
97 | // scroll, respectively | |
98 | wxWindow *m_win, | |
99 | *m_targetWindow; | |
47062523 VZ |
100 | |
101 | // whether cursor keys should scroll the window | |
102 | bool m_kbdScrollingEnabled; | |
010d821b VZ |
103 | }; |
104 | ||
105 | // This is the class containing the guts of (uniform) scrolling logic. | |
106 | class WXDLLIMPEXP_CORE wxScrollHelperBase : public wxAnyScrollHelperBase | |
fa3541bd JS |
107 | { |
108 | public: | |
d32e78bd | 109 | // ctor must be given the associated window |
29e1398f VZ |
110 | wxScrollHelperBase(wxWindow *winToScroll); |
111 | virtual ~wxScrollHelperBase(); | |
1e6feb95 VZ |
112 | |
113 | // configure the scrolling | |
114 | virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, | |
115 | int noUnitsX, int noUnitsY, | |
116 | int xPos = 0, int yPos = 0, | |
d775fa82 | 117 | bool noRefresh = false ); |
1e6feb95 VZ |
118 | |
119 | // scroll to the given (in logical coords) position | |
bc448be3 VZ |
120 | // |
121 | // notice that for backwards compatibility reasons Scroll() is virtual as | |
122 | // the existing code could override it but new code should override | |
123 | // DoScroll() instead | |
124 | virtual void Scroll(int x, int y) { DoScroll(x, y); } | |
125 | virtual void Scroll(const wxPoint& pt) { DoScroll(pt.x, pt.y); } | |
1e6feb95 VZ |
126 | |
127 | // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL) | |
128 | int GetScrollPageSize(int orient) const; | |
129 | void SetScrollPageSize(int orient, int pageSize); | |
130 | ||
0b0f6f87 | 131 | // get the number of lines the window can scroll, |
5713b349 RR |
132 | // returns 0 if no scrollbars are there. |
133 | int GetScrollLines( int orient ) const; | |
134 | ||
566d84a7 RL |
135 | // Set the x, y scrolling increments. |
136 | void SetScrollRate( int xstep, int ystep ); | |
137 | ||
1e6feb95 | 138 | // get the size of one logical unit in physical ones |
29e1398f | 139 | void GetScrollPixelsPerUnit(int *pixelsPerUnitX, int *pixelsPerUnitY) const; |
1e6feb95 | 140 | |
6362d82b VZ |
141 | // Set scrollbar visibility: it is possible to show scrollbar only if it is |
142 | // needed (i.e. if our virtual size is greater than the current size of the | |
143 | // associated window), always (as wxALWAYS_SHOW_SB style does) or never (in | |
144 | // which case you should provide some other way to scroll the window as the | |
145 | // user wouldn't be able to do it at all) | |
69e97525 VZ |
146 | void ShowScrollbars(wxScrollbarVisibility horz, wxScrollbarVisibility vert) |
147 | { | |
148 | DoShowScrollbars(horz, vert); | |
149 | } | |
6362d82b | 150 | |
029a401d VZ |
151 | // Test whether the specified scrollbar is shown. |
152 | virtual bool IsScrollbarShown(int orient) const = 0; | |
153 | ||
d775fa82 | 154 | // Enable/disable Windows scrolling in either direction. If true, wxWidgets |
1e6feb95 | 155 | // scrolls the canvas and only a bit of the canvas is invalidated; no |
d775fa82 | 156 | // Clear() is necessary. If false, the whole canvas is invalidated and a |
1e6feb95 VZ |
157 | // Clear() is necessary. Disable for when the scroll increment is used to |
158 | // actually scroll a non-constant distance | |
de168da1 VZ |
159 | // |
160 | // Notice that calling this method with a false argument doesn't disable | |
161 | // scrolling the window in this direction, it just changes the mechanism by | |
162 | // which it is implemented to not use wxWindow::ScrollWindow(). | |
1e6feb95 VZ |
163 | virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); |
164 | ||
165 | // Get the view start | |
0b0f6f87 VZ |
166 | void GetViewStart(int *x, int *y) const { DoGetViewStart(x, y); } |
167 | ||
168 | wxPoint GetViewStart() const | |
169 | { | |
170 | wxPoint pt; | |
171 | DoGetViewStart(&pt.x, &pt.y); | |
172 | return pt; | |
173 | } | |
1e6feb95 | 174 | |
1e6feb95 VZ |
175 | // Set the scale factor, used in PrepareDC |
176 | void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; } | |
177 | double GetScaleX() const { return m_scaleX; } | |
178 | double GetScaleY() const { return m_scaleY; } | |
179 | ||
180 | // translate between scrolled and unscrolled coordinates | |
8c2f3797 VS |
181 | void CalcScrolledPosition(int x, int y, int *xx, int *yy) const |
182 | { DoCalcScrolledPosition(x, y, xx, yy); } | |
183 | wxPoint CalcScrolledPosition(const wxPoint& pt) const | |
184 | { | |
185 | wxPoint p2; | |
186 | DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y); | |
187 | return p2; | |
188 | } | |
189 | ||
190 | void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const | |
191 | { DoCalcUnscrolledPosition(x, y, xx, yy); } | |
192 | wxPoint CalcUnscrolledPosition(const wxPoint& pt) const | |
193 | { | |
194 | wxPoint p2; | |
195 | DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y); | |
196 | return p2; | |
197 | } | |
0d6d6051 | 198 | |
29e1398f VZ |
199 | void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const; |
200 | void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; | |
1e6feb95 VZ |
201 | |
202 | // Adjust the scrollbars | |
29e1398f | 203 | virtual void AdjustScrollbars() = 0; |
1e6feb95 VZ |
204 | |
205 | // Calculate scroll increment | |
29e1398f | 206 | int CalcScrollInc(wxScrollWinEvent& event); |
1e6feb95 VZ |
207 | |
208 | // Normally the wxScrolledWindow will scroll itself, but in some rare | |
209 | // occasions you might want it to scroll [part of] another window (e.g. a | |
210 | // child of it in order to scroll only a portion the area between the | |
211 | // scrollbars (spreadsheet: only cell area will move). | |
29e1398f | 212 | void SetTargetWindow(wxWindow *target); |
1e6feb95 VZ |
213 | |
214 | void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; } | |
215 | wxRect GetTargetRect() const { return m_rectToScroll; } | |
216 | ||
1e6feb95 VZ |
217 | virtual void DoPrepareDC(wxDC& dc); |
218 | ||
219 | // are we generating the autoscroll events? | |
220 | bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; } | |
221 | ||
222 | // stop generating the scroll events when mouse is held outside the window | |
223 | void StopAutoScrolling(); | |
224 | ||
225 | // this method can be overridden in a derived class to forbid sending the | |
226 | // auto scroll events - note that unlike StopAutoScrolling() it doesn't | |
227 | // stop the timer, so it will be called repeatedly and will typically | |
228 | // return different values depending on the current mouse position | |
229 | // | |
d775fa82 | 230 | // the base class version just returns true |
1e6feb95 VZ |
231 | virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const; |
232 | ||
233 | // the methods to be called from the window event handlers | |
234 | void HandleOnScroll(wxScrollWinEvent& event); | |
235 | void HandleOnSize(wxSizeEvent& event); | |
1e6feb95 VZ |
236 | void HandleOnMouseEnter(wxMouseEvent& event); |
237 | void HandleOnMouseLeave(wxMouseEvent& event); | |
e421922f | 238 | #if wxUSE_MOUSEWHEEL |
1e6feb95 | 239 | void HandleOnMouseWheel(wxMouseEvent& event); |
e421922f | 240 | #endif // wxUSE_MOUSEWHEEL |
06b9c2a2 | 241 | void HandleOnChildFocus(wxChildFocusEvent& event); |
1e6feb95 | 242 | |
bca15044 VZ |
243 | #if WXWIN_COMPATIBILITY_2_8 |
244 | wxDEPRECATED( | |
245 | void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); } | |
246 | ) | |
247 | #endif // WXWIN_COMPATIBILITY_2_8 | |
2ec0173d | 248 | |
1e6feb95 VZ |
249 | protected: |
250 | // get pointer to our scroll rect if we use it or NULL | |
d5d58a93 | 251 | const wxRect *GetScrollRect() const |
1e6feb95 VZ |
252 | { |
253 | return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL; | |
254 | } | |
255 | ||
256 | // get the size of the target window | |
257 | wxSize GetTargetSize() const | |
fa3541bd | 258 | { |
1e6feb95 VZ |
259 | return m_rectToScroll.width != 0 ? m_rectToScroll.GetSize() |
260 | : m_targetWindow->GetClientSize(); | |
fa3541bd | 261 | } |
1e6feb95 | 262 | |
2d6dd9c0 | 263 | void GetTargetSize(int *w, int *h) const |
1e6feb95 VZ |
264 | { |
265 | wxSize size = GetTargetSize(); | |
266 | if ( w ) | |
267 | *w = size.x; | |
268 | if ( h ) | |
269 | *h = size.y; | |
270 | } | |
271 | ||
0b0f6f87 VZ |
272 | // implementation of public methods with the same name |
273 | virtual void DoGetViewStart(int *x, int *y) const; | |
29e1398f | 274 | virtual void DoScroll(int x, int y) = 0; |
6362d82b | 275 | virtual void DoShowScrollbars(wxScrollbarVisibility horz, |
29e1398f | 276 | wxScrollbarVisibility vert) = 0; |
0b0f6f87 | 277 | |
d32e78bd VZ |
278 | // implementations of various wxWindow virtual methods which should be |
279 | // forwarded to us (this can be done by WX_FORWARD_TO_SCROLL_HELPER()) | |
280 | bool ScrollLayout(); | |
281 | void ScrollDoSetVirtualSize(int x, int y); | |
282 | wxSize ScrollGetBestVirtualSize() const; | |
d32e78bd | 283 | |
349efbaa VZ |
284 | // change just the target window (unlike SetWindow which changes m_win as |
285 | // well) | |
af4088f1 | 286 | void DoSetTargetWindow(wxWindow *target); |
349efbaa VZ |
287 | |
288 | // delete the event handler we installed | |
289 | void DeleteEvtHandler(); | |
290 | ||
f9ec0ea7 VZ |
291 | // this function should be overridden to return the size available for |
292 | // m_targetWindow inside m_win of the given size | |
293 | // | |
294 | // the default implementation is only good for m_targetWindow == m_win | |
295 | // case, if we're scrolling a subwindow you must override this method | |
296 | virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) | |
297 | { | |
5eda3bcd VZ |
298 | // returning just size from here is wrong but it was decided that it is |
299 | // not wrong enough to break the existing code (which doesn't override | |
300 | // this recently added function at all) by adding this assert | |
301 | // | |
302 | // wxASSERT_MSG( m_targetWindow == m_win, "must be overridden" ); | |
f9ec0ea7 VZ |
303 | |
304 | return size; | |
305 | } | |
306 | ||
d32e78bd | 307 | |
39ae1f13 WS |
308 | double m_scaleX; |
309 | double m_scaleY; | |
310 | ||
1e6feb95 VZ |
311 | wxRect m_rectToScroll; |
312 | ||
313 | wxTimer *m_timerAutoScroll; | |
314 | ||
de168da1 VZ |
315 | // The number of pixels to scroll in horizontal and vertical directions |
316 | // respectively. | |
317 | // | |
318 | // If 0, means that the scrolling in the given direction is disabled. | |
1e6feb95 VZ |
319 | int m_xScrollPixelsPerLine; |
320 | int m_yScrollPixelsPerLine; | |
321 | int m_xScrollPosition; | |
322 | int m_yScrollPosition; | |
323 | int m_xScrollLines; | |
324 | int m_yScrollLines; | |
325 | int m_xScrollLinesPerPage; | |
326 | int m_yScrollLinesPerPage; | |
327 | ||
328 | bool m_xScrollingEnabled; | |
329 | bool m_yScrollingEnabled; | |
330 | ||
e421922f VZ |
331 | #if wxUSE_MOUSEWHEEL |
332 | int m_wheelRotation; | |
333 | #endif // wxUSE_MOUSEWHEEL | |
349efbaa VZ |
334 | |
335 | wxScrollHelperEvtHandler *m_handler; | |
22f3361e | 336 | |
c0c133e1 | 337 | wxDECLARE_NO_COPY_CLASS(wxScrollHelperBase); |
fa3541bd | 338 | }; |
1e6feb95 | 339 | |
d32e78bd VZ |
340 | // this macro can be used in a wxScrollHelper-derived class to forward wxWindow |
341 | // methods to corresponding wxScrollHelper methods | |
342 | #define WX_FORWARD_TO_SCROLL_HELPER() \ | |
8b64a7e2 | 343 | public: \ |
d32e78bd VZ |
344 | virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } \ |
345 | virtual bool Layout() { return ScrollLayout(); } \ | |
029a401d VZ |
346 | virtual bool CanScroll(int orient) const \ |
347 | { return IsScrollbarShown(orient); } \ | |
d32e78bd VZ |
348 | virtual void DoSetVirtualSize(int x, int y) \ |
349 | { ScrollDoSetVirtualSize(x, y); } \ | |
350 | virtual wxSize GetBestVirtualSize() const \ | |
7d616e99 | 351 | { return ScrollGetBestVirtualSize(); } |
d32e78bd | 352 | |
29e1398f | 353 | // include the declaration of the real wxScrollHelper |
1be7a35c | 354 | #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) |
d32e78bd | 355 | #include "wx/gtk/scrolwin.h" |
1be7a35c MR |
356 | #elif defined(__WXGTK__) && !defined(__WXUNIVERSAL__) |
357 | #include "wx/gtk1/scrolwin.h" | |
d32e78bd | 358 | #else |
29e1398f VZ |
359 | #define wxHAS_GENERIC_SCROLLWIN |
360 | #include "wx/generic/scrolwin.h" | |
adfea104 JS |
361 | #endif |
362 | ||
1e6feb95 | 363 | // ---------------------------------------------------------------------------- |
16361ec9 | 364 | // wxScrolled<T>: a wxWindow which knows how to scroll |
1e6feb95 VZ |
365 | // ---------------------------------------------------------------------------- |
366 | ||
16361ec9 VS |
367 | // helper class for wxScrolled<T> below |
368 | struct WXDLLIMPEXP_CORE wxScrolledT_Helper | |
369 | { | |
370 | static wxSize FilterBestSize(const wxWindow *win, | |
29e1398f | 371 | const wxScrollHelper *helper, |
16361ec9 VS |
372 | const wxSize& origBest); |
373 | #ifdef __WXMSW__ | |
f2a6c918 | 374 | static WXLRESULT FilterMSWWindowProc(WXUINT nMsg, WXLRESULT origResult); |
16361ec9 VS |
375 | #endif |
376 | }; | |
377 | ||
378 | // Scrollable window base on window type T. This used to be wxScrolledWindow, | |
379 | // but wxScrolledWindow includes wxControlContainer functionality and that's | |
380 | // not always desirable. | |
381 | template<class T> | |
cb7c02fd VZ |
382 | class wxScrolled : public T, |
383 | public wxScrollHelper, | |
384 | private wxScrolledT_Helper | |
d32e78bd VZ |
385 | { |
386 | public: | |
29e1398f | 387 | wxScrolled() : wxScrollHelper(this) { } |
16361ec9 VS |
388 | wxScrolled(wxWindow *parent, |
389 | wxWindowID winid = wxID_ANY, | |
390 | const wxPoint& pos = wxDefaultPosition, | |
391 | const wxSize& size = wxDefaultSize, | |
392 | long style = wxScrolledWindowStyle, | |
393 | const wxString& name = wxPanelNameStr) | |
29e1398f | 394 | : wxScrollHelper(this) |
1e6feb95 | 395 | { |
d32e78bd VZ |
396 | Create(parent, winid, pos, size, style, name); |
397 | } | |
c801d85f | 398 | |
d32e78bd VZ |
399 | bool Create(wxWindow *parent, |
400 | wxWindowID winid, | |
401 | const wxPoint& pos = wxDefaultPosition, | |
402 | const wxSize& size = wxDefaultSize, | |
403 | long style = wxScrolledWindowStyle, | |
16361ec9 VS |
404 | const wxString& name = wxPanelNameStr) |
405 | { | |
406 | m_targetWindow = this; | |
407 | ||
408 | #ifdef __WXMAC__ | |
9fdb68d9 | 409 | this->MacSetClipChildren(true); |
16361ec9 VS |
410 | #endif |
411 | ||
16361ec9 VS |
412 | // by default, we're scrollable in both directions (but if one of the |
413 | // styles is specified explicitly, we shouldn't add the other one | |
414 | // automatically) | |
415 | if ( !(style & (wxHSCROLL | wxVSCROLL)) ) | |
416 | style |= wxHSCROLL | wxVSCROLL; | |
417 | ||
96943967 SC |
418 | #ifdef __WXOSX__ |
419 | bool retval = T::Create(parent, winid, pos, size, style, name); | |
420 | if ( retval && (style & wxALWAYS_SHOW_SB) ) | |
421 | ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS); | |
422 | return retval; | |
423 | #else | |
2119b213 VZ |
424 | if ( style & wxALWAYS_SHOW_SB ) |
425 | ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS); | |
426 | ||
16361ec9 | 427 | return T::Create(parent, winid, pos, size, style, name); |
96943967 | 428 | #endif |
16361ec9 | 429 | } |
d32e78bd | 430 | |
208717f6 | 431 | #ifdef __WXMSW__ |
6f02a879 VZ |
432 | // we need to return a special WM_GETDLGCODE value to process just the |
433 | // arrows but let the other navigation characters through | |
16361ec9 VS |
434 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) |
435 | { | |
f2a6c918 | 436 | return FilterMSWWindowProc(nMsg, T::MSWWindowProc(nMsg, wParam, lParam)); |
16361ec9 | 437 | } |
208717f6 VZ |
438 | |
439 | // Take into account the scroll origin. | |
440 | virtual void MSWAdjustBrushOrg(int* xOrg, int* yOrg) const | |
441 | { | |
442 | CalcUnscrolledPosition(*xOrg, *yOrg, xOrg, yOrg); | |
443 | } | |
6f02a879 VZ |
444 | #endif // __WXMSW__ |
445 | ||
d32e78bd VZ |
446 | WX_FORWARD_TO_SCROLL_HELPER() |
447 | ||
448 | protected: | |
16361ec9 VS |
449 | virtual wxSize DoGetBestSize() const |
450 | { | |
451 | return FilterBestSize(this, this, T::DoGetBestSize()); | |
452 | } | |
7d616e99 | 453 | |
16361ec9 | 454 | private: |
707d9f40 VZ |
455 | // VC++ 6 gives warning for the declaration of template member function |
456 | // without definition | |
ce38e440 | 457 | #ifndef __VISUALC6__ |
c0c133e1 | 458 | wxDECLARE_NO_COPY_CLASS(wxScrolled); |
707d9f40 | 459 | #endif |
16361ec9 VS |
460 | }; |
461 | ||
ce38e440 VZ |
462 | #ifdef __VISUALC6__ |
463 | // disable the warning about non dll-interface class used as base for | |
464 | // dll-interface class: it's harmless in this case | |
465 | #pragma warning(push) | |
466 | #pragma warning(disable:4275) | |
467 | #endif | |
468 | ||
16361ec9 VS |
469 | // for compatibility with existing code, we provide wxScrolledWindow |
470 | // "typedef" for wxScrolled<wxPanel>. It's not a real typedef because we | |
471 | // want wxScrolledWindow to show in wxRTTI information (the class is widely | |
472 | // used and likelihood of its wxRTTI information being used too is high): | |
473 | class WXDLLIMPEXP_CORE wxScrolledWindow : public wxScrolled<wxPanel> | |
474 | { | |
475 | public: | |
476 | wxScrolledWindow() : wxScrolled<wxPanel>() {} | |
477 | wxScrolledWindow(wxWindow *parent, | |
478 | wxWindowID winid = wxID_ANY, | |
479 | const wxPoint& pos = wxDefaultPosition, | |
480 | const wxSize& size = wxDefaultSize, | |
481 | long style = wxScrolledWindowStyle, | |
482 | const wxString& name = wxPanelNameStr) | |
483 | : wxScrolled<wxPanel>(parent, winid, pos, size, style, name) {} | |
d32e78bd | 484 | |
d32e78bd | 485 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow) |
d32e78bd VZ |
486 | }; |
487 | ||
16361ec9 | 488 | typedef wxScrolled<wxWindow> wxScrolledCanvas; |
566d84a7 | 489 | |
ce38e440 VZ |
490 | #ifdef __VISUALC6__ |
491 | #pragma warning(pop) | |
492 | #endif | |
493 | ||
16361ec9 | 494 | #endif // _WX_SCROLWIN_H_BASE_ |