]> git.saurik.com Git - wxWidgets.git/blob - interface/vscroll.h
fixing file paths after renaming
[wxWidgets.git] / interface / vscroll.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: vscroll.h
3 // Purpose: interface of wxVarHScrollHelper
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxVarScrollHelperBase
11 @wxheader{vscroll.h}
12
13 This class provides all common base functionality for scroll calculations
14 shared among all variable scrolled window implementations as well as
15 automatic scrollbar functionality, saved scroll positions, controlling
16 target windows to be scrolled, as well as defining all required virtual
17 functions that need to be implemented for any orientation specific work.
18
19 Documentation of this class is provided specifically for referencing use
20 of the functions provided by this class for use with the variable scrolled
21 windows that derive from here. You will likely want to derive your window
22 from one of the already implemented variable scrolled windows rather than
23 from wxVarScrollHelperBase directly.
24
25 @library{wxcore}
26 @category{miscwnd}
27
28 @see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
29 */
30 class wxVarScrollHelperBase
31 {
32 public:
33 /**
34 Constructor taking the target window to be scrolled by this helper
35 class. This will attach scroll event handlers to the target window to
36 catch and handle scroll events appropriately.
37 */
38 wxVarScrollHelperBase(wxWindow* winToScroll);
39
40 /**
41 Virtual destructor for detaching scroll event handlers attached with
42 this helper class.
43 */
44 virtual ~wxVarScrollHelperBase();
45
46 /**
47 Translates the logical coordinate given to the current device
48 coordinate. For example, if the window is scrolled 10 units and each
49 scroll unit represents 10 device units (which may not be the case since
50 this class allows for variable scroll unit sizes), a call to this
51 function with a coordinate of 15 will return -85.
52
53 @see CalcUnscrolledPosition()
54 */
55 int CalcScrolledPosition(int coord) const;
56
57 /**
58 Translates the device coordinate given to the corresponding logical
59 coordinate. For example, if the window is scrolled 10 units and each
60 scroll unit represents 10 device units (which may not be the case since
61 this class allows for variable scroll unit sizes), a call to this
62 function with a coordinate of 15 will return 115.
63
64 @see CalcScrolledPosition()
65 */
66 int CalcUnscrolledPosition(int coord) const;
67
68 /**
69 With physical scrolling on (when this is @true), the device origin is
70 changed properly when a wxPaintDC is prepared, children are actually
71 moved and laid out properly, and the contents of the window (pixels)
72 are actually moved. When this is @false, you are responsible for
73 repainting any invalidated areas of the window yourself to account for
74 the new scroll position.
75 */
76 void EnablePhysicalScrolling(bool scrolling = true);
77
78 /**
79 When the number of scroll units change, we try to estimate the total
80 size of all units when the full window size is needed (i.e. to
81 calculate the scrollbar thumb size). This is a rather expensive
82 operation in terms of unit access, so if the user code may estimate the
83 average size better or faster than we do, it should override this
84 function to implement its own logic. This function should return the
85 best guess for the total virtual window size.
86
87 @note Although returning a totally wrong value would still work, it
88 risks resulting in very strange scrollbar behaviour so this
89 function should really try to make the best guess possible.
90 */
91 virtual wxCoord EstimateTotalSize() const;
92
93 /**
94 This function needs to be overridden in the in the derived class to
95 return the window size with respect to the opposing orientation. If
96 this is a vertical scrolled window, it should return the height.
97
98 @see GetOrientationTargetSize()
99 */
100 virtual int GetNonOrientationTargetSize() const;
101
102 /**
103 This function need to be overridden to return the orientation that this
104 helper is working with, either @c wxHORIZONTAL or @c wxVERTICAL.
105 */
106 virtual wxOrientation GetOrientation() const;
107
108 /**
109 This function needs to be overridden in the in the derived class to
110 return the window size with respect to the orientation this helper is
111 working with. If this is a vertical scrolled window, it should return
112 the width.
113
114 @see GetNonOrientationTargetSize()
115 */
116 virtual int GetOrientationTargetSize() const;
117
118 /**
119 This function will return the target window this helper class is
120 currently scrolling.
121
122 @see SetTargetWindow()
123 */
124 wxWindow* GetTargetWindow() const;
125
126 /**
127 Returns the index of the first visible unit based on the scroll
128 position.
129 */
130 size_t GetVisibleBegin() const;
131
132 /**
133 Returns the index of the last visible unit based on the scroll
134 position. This includes the last unit even if it is only partially
135 visible.
136 */
137 size_t GetVisibleEnd() const;
138
139 /**
140 Returns @true if the given scroll unit is currently visible (even if
141 only partially visible) or @false otherwise.
142 */
143 bool IsVisible(size_t unit) const;
144
145 /**
146 This function must be overridden in the derived class, and should
147 return the size of the given unit in pixels.
148 */
149 virtual wxCoord OnGetUnitSize(size_t unit) const;
150
151 /**
152 This function doesn't have to be overridden but it may be useful to do
153 so if calculating the units' sizes is a relatively expensive operation
154 as it gives your code a chance to calculate several of them at once and
155 cache the result if necessary.
156
157 OnGetUnitsSizeHint() is normally called just before OnGetUnitSize() but
158 you shouldn't rely on the latter being called for all units in the
159 interval specified here. It is also possible that OnGetUnitSize() will
160 be called for units outside of this interval, so this is really just a
161 hint, not a promise.
162
163 Finally, note that @a unitMin is inclusive, while @a unitMax is
164 exclusive.
165 */
166 virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const;
167
168 /**
169 Recalculate all parameters and repaint all units.
170 */
171 virtual void RefreshAll();
172
173 /**
174 Normally the window will scroll itself, but in some rare occasions you
175 might want it to scroll (part of) another window (e.g. a child of it in
176 order to scroll only a portion the area between the scrollbars like a
177 spreadsheet where only the cell area will move).
178
179 @see GetTargetWindow()
180 */
181 void SetTargetWindow(wxWindow* target);
182
183 /**
184 Update the thumb size shown by the scrollbar.
185 */
186 virtual void UpdateScrollbar();
187
188 /**
189 Returns the virtual scroll unit under the device unit given accounting
190 for scroll position or @c wxNOT_FOUND if none (i.e. if it is below the
191 last item).
192 */
193 int VirtualHitTest(wxCoord coord) const;
194 };
195
196
197
198 /**
199 @class wxVarVScrollHelper
200 @wxheader{vscroll.h}
201
202 This class provides functions wrapping the wxVarScrollHelperBase class,
203 targeted for vertical-specific scrolling.
204
205 Like wxVarScrollHelperBase, this class is mostly only useful to those
206 classes built into wxWidgets deriving from here, and this documentation is
207 mostly only provided for referencing the functions provided by this class.
208 You will likely want to derive your window from wxVScrolledWindow rather
209 than from here directly.
210
211 @library{wxcore}
212 @category{miscwnd}
213
214 @see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
215 */
216 class wxVarVScrollHelper : public wxVarScrollHelperBase
217 {
218 public:
219 /**
220 Constructor taking the target window to be scrolled by this helper
221 class. This will attach scroll event handlers to the target window to
222 catch and handle scroll events appropriately.
223 */
224 wxVarVScrollHelper(wxWindow* winToScroll);
225
226 /**
227 This class forwards calls from EstimateTotalSize() to this function so
228 derived classes can override either just the height or the width
229 estimation, or just estimate both differently if desired in any
230 wxHVScrolledWindow derived class.
231
232 @note This function will not be called if EstimateTotalSize() is
233 overridden in your derived class.
234 */
235 virtual wxCoord EstimateTotalHeight() const;
236
237 /**
238 Returns the number of rows the target window contains.
239
240 @see SetRowCount()
241 */
242 size_t GetRowCount() const;
243
244 /**
245 Returns the index of the first visible row based on the scroll
246 position.
247 */
248 size_t GetVisibleRowsBegin() const;
249
250 /**
251 Returns the index of the last visible row based on the scroll position.
252 This includes the last row even if it is only partially visible.
253 */
254 size_t GetVisibleRowsEnd() const;
255
256 /**
257 Returns @true if the given row is currently visible (even if only
258 partially visible) or @false otherwise.
259 */
260 bool IsRowVisible(size_t row) const;
261
262 /**
263 This function must be overridden in the derived class, and should
264 return the height of the given row in pixels.
265 */
266 virtual wxCoord OnGetRowHeight(size_t row) const;
267
268 /**
269 This function doesn't have to be overridden but it may be useful to do
270 so if calculating the rows' sizes is a relatively expensive operation
271 as it gives your code a chance to calculate several of them at once and
272 cache the result if necessary.
273
274 OnGetRowsHeightHint() is normally called just before OnGetRowHeight()
275 but you shouldn't rely on the latter being called for all rows in the
276 interval specified here. It is also possible that OnGetRowHeight() will
277 be called for units outside of this interval, so this is really just a
278 hint, not a promise.
279
280 Finally, note that @a rowMin is inclusive, while @a rowMax is
281 exclusive.
282 */
283 virtual void OnGetRowsHeightHint(size_t rowMin, size_t rowMax) const;
284
285 /**
286 Triggers a refresh for just the given row's area of the window if it's
287 visible.
288 */
289 virtual void RefreshRow(size_t row);
290
291 /**
292 Triggers a refresh for the area between the specified range of rows
293 given (inclusively).
294 */
295 virtual void RefreshRows(size_t from, size_t to);
296
297 /**
298 Scroll by the specified number of pages which may be positive (to
299 scroll down) or negative (to scroll up).
300 */
301 virtual bool ScrollRowPages(int pages);
302
303 /**
304 Scroll by the specified number of rows which may be positive (to scroll
305 down) or negative (to scroll up).
306
307 @return @true if the window was scrolled, @false otherwise (for
308 example, if we're trying to scroll down but we are already
309 showing the last row).
310 */
311 virtual bool ScrollRows(int rows);
312
313 /**
314 Scroll to the specified row. It will become the first visible row in
315 the window.
316
317 @return @true if we scrolled the window, @false if nothing was done.
318 */
319 bool ScrollToRow(size_t row);
320
321 /**
322 Set the number of rows the window contains. The derived class must
323 provide the heights for all rows with indices up to the one given here
324 in it's OnGetRowHeight() implementation.
325
326 @see GetRowCount()
327 */
328 void SetRowCount(size_t rowCount);
329 };
330
331
332
333 /**
334 @class wxVarHScrollHelper
335 @wxheader{vscroll.h}
336
337 This class provides functions wrapping the wxVarScrollHelperBase class,
338 targeted for horizontal-specific scrolling.
339
340 Like wxVarScrollHelperBase, this class is mostly only useful to those
341 classes built into wxWidgets deriving from here, and this documentation is
342 mostly only provided for referencing the functions provided by this class.
343 You will likely want to derive your window from wxHScrolledWindow rather
344 than from here directly.
345
346 @library{wxcore}
347 @category{miscwnd}
348
349 @see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
350 */
351 class wxVarHScrollHelper : public wxVarScrollHelperBase
352 {
353 public:
354 /**
355 Constructor taking the target window to be scrolled by this helper
356 class. This will attach scroll event handlers to the target window to
357 catch and handle scroll events appropriately.
358 */
359 wxVarHScrollHelper(wxWindow* winToScroll);
360
361 /**
362 This class forwards calls from EstimateTotalSize() to this function so
363 derived classes can override either just the height or the width
364 estimation, or just estimate both differently if desired in any
365 wxHVScrolledWindow derived class.
366
367 @note This function will not be called if EstimateTotalSize() is
368 overridden in your derived class.
369 */
370 virtual wxCoord EstimateTotalWidth() const;
371
372 /**
373 Returns the number of columns the target window contains.
374
375 @see SetColumnCount()
376 */
377 size_t GetColumnCount() const;
378
379 /**
380 Returns the index of the first visible column based on the scroll
381 position.
382 */
383 size_t GetVisibleColumnsBegin() const;
384
385 /**
386 Returns the index of the last visible column based on the scroll
387 position. This includes the last column even if it is only partially
388 visible.
389 */
390 size_t GetVisibleColumnsEnd() const;
391
392 /**
393 Returns @true if the given column is currently visible (even if only
394 partially visible) or @false otherwise.
395 */
396 bool IsColumnVisible(size_t column) const;
397
398 /**
399 This function must be overridden in the derived class, and should
400 return the width of the given column in pixels.
401 */
402 virtual wxCoord OnGetColumnWidth(size_t column) const;
403
404 /**
405 This function doesn't have to be overridden but it may be useful to do
406 so if calculating the columns' sizes is a relatively expensive
407 operation as it gives your code a chance to calculate several of them
408 at once and cache the result if necessary.
409
410 OnGetColumnsWidthHint() is normally called just before
411 OnGetColumnWidth() but you shouldn't rely on the latter being called
412 for all columns in the interval specified here. It is also possible
413 that OnGetColumnWidth() will be called for units outside of this
414 interval, so this is really just a hint, not a promise.
415
416 Finally, note that @a columnMin is inclusive, while @a columnMax is
417 exclusive.
418 */
419 virtual void OnGetColumnsWidthHint(size_t columnMin,
420 size_t columnMax) const;
421
422 /**
423 Triggers a refresh for just the given column's area of the window if
424 it's visible.
425 */
426 virtual void RefreshColumn(size_t column);
427
428 /**
429 Triggers a refresh for the area between the specified range of columns
430 given (inclusively).
431 */
432 virtual void RefreshColumns(size_t from, size_t to);
433
434 /**
435 Scroll by the specified number of pages which may be positive (to
436 scroll right) or negative (to scroll left).
437 */
438 virtual bool ScrollColumnPages(int pages);
439
440 /**
441 Scroll by the specified number of columns which may be positive (to
442 scroll right) or negative (to scroll left).
443
444 @return @true if the window was scrolled, @false otherwise (for
445 example, if we're trying to scroll right but we are already
446 showing the last column).
447 */
448 virtual bool ScrollColumns(int columns);
449
450 /**
451 Scroll to the specified column. It will become the first visible column
452 in the window.
453
454 @return @true if we scrolled the window, @false if nothing was done.
455 */
456 bool ScrollToColumn(size_t column);
457
458 /**
459 Set the number of columns the window contains. The derived class must
460 provide the widths for all columns with indices up to the one given
461 here in it's OnGetColumnWidth() implementation.
462
463 @see GetColumnCount()
464 */
465 void SetColumnCount(size_t columnCount);
466 };
467
468
469
470 /**
471 @class wxVarHVScrollHelper
472 @wxheader{vscroll.h}
473
474 This class provides functions wrapping the wxVarHScrollHelper and
475 wxVarVScrollHelper classes, targeted for scrolling a window in both axis.
476 Since this class is also the join class of the horizontal and vertical
477 scrolling functionality, it also addresses some wrappers that help avoid
478 the need to specify class scope in your wxHVScrolledWindow derived class
479 when using wxVarScrollHelperBase functionality.
480
481 Like all three of it's scroll helper base classes, this class is mostly
482 only useful to those classes built into wxWidgets deriving from here, and
483 this documentation is mostly only provided for referencing the functions
484 provided by this class. You will likely want to derive your window from
485 wxHVScrolledWindow rather than from here directly.
486
487 @library{wxcore}
488 @category{miscwnd}
489
490 @see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
491 */
492 class wxVarHVScrollHelper : public wxVarVScrollHelper,
493 public wxVarHScrollHelper
494 {
495 public:
496 /**
497 Constructor taking the target window to be scrolled by this helper
498 class. This will attach scroll event handlers to the target window to
499 catch and handle scroll events appropriately.
500 */
501 wxVarHVScrollHelper(wxWindow* winToScroll);
502
503 /**
504 With physical scrolling on (when this is @true), the device origin is
505 changed properly when a wxPaintDC is prepared, children are actually
506 moved and laid out properly, and the contents of the window (pixels)
507 are actually moved. When this is @false, you are responsible for
508 repainting any invalidated areas of the window yourself to account for
509 the new scroll position.
510
511 @param vscrolling
512 Specifies if physical scrolling should be turned on when scrolling
513 vertically.
514 @param hscrolling
515 Specifies if physical scrolling should be turned on when scrolling
516 horizontally.
517 */
518 void EnablePhysicalScrolling(bool vscrolling = true,
519 bool hscrolling = true);
520
521 /**
522 Returns the number of columns and rows the target window contains.
523
524 @see SetRowColumnCount()
525 */
526 wxSize GetRowColumnCount() const;
527
528 /**
529 Returns the index of the first visible column and row based on the
530 current scroll position.
531 */
532 wxPosition GetVisibleBegin() const;
533
534 /**
535 Returns the index of the last visible column and row based on the
536 scroll position. This includes any partially visible columns or rows.
537 */
538 wxPosition GetVisibleEnd() const;
539
540 //@{
541 /**
542 Returns @true if both the given row and column are currently visible
543 (even if only partially visible) or @false otherwise.
544 */
545 bool IsVisible(size_t row, size_t column) const;
546 bool IsVisible(const wxPosition& pos) const;
547 //@}
548
549 //@{
550 /**
551 Triggers a refresh for just the area shared between the given row and
552 column of the window if it is visible.
553 */
554 virtual void RefreshRowColumn(size_t row, size_t column);
555 virtual void RefreshRowColumn(const wxPosition& pos);
556 //@}
557
558 //@{
559 /**
560 Triggers a refresh for the visible area shared between all given rows
561 and columns (inclusive) of the window. If the target window for both
562 orientations is the same, the rectangle of cells is refreshed; if the
563 target windows differ, the entire client size opposite the orientation
564 direction is refreshed between the specified limits.
565 */
566 virtual void RefreshRowsColumns(size_t fromRow, size_t toRow,
567 size_t fromColumn, size_t toColumn);
568 virtual void RefreshRowsColumns(const wxPosition& from,
569 const wxPosition& to);
570 //@}
571
572 //@{
573 /**
574 Scroll to the specified row and column. It will become the first
575 visible row and column in the window. Returns @true if we scrolled the
576 window, @false if nothing was done.
577 */
578 bool ScrollToRowColumn(size_t row, size_t column);
579 bool ScrollToRowColumn(const wxPosition& pos);
580 //@}
581
582 /**
583 Set the number of rows and columns the target window will contain. The
584 derived class must provide the sizes for all rows and columns with
585 indices up to the ones given here in it's OnGetRowHeight() and
586 OnGetColumnWidth() implementations, respectively.
587
588 @see GetRowColumnCount()
589 */
590 void SetRowColumnCount(size_t rowCount, size_t columnCount);
591
592 //@{
593 /**
594 Returns the virtual scroll unit under the device unit given accounting
595 for scroll position or @c wxNOT_FOUND (for the row, column, or possibly
596 both values) if none.
597 */
598 wxPosition VirtualHitTest(wxCoord x, wxCoord y) const;
599 wxPosition VirtualHitTest(const wxPoint& pos) const;
600 //@}
601 };
602
603
604
605 /**
606 @class wxVScrolledWindow
607 @wxheader{vscroll.h}
608
609 In the name of this class, "V" may stand for "variable" because it can be
610 used for scrolling rows of variable heights; "virtual", because it is not
611 necessary to know the heights of all rows in advance -- only those which
612 are shown on the screen need to be measured; or even "vertical", because
613 this class only supports scrolling vertically.
614
615 In any case, this is a generalization of wxScrolled which can be only used
616 when all rows have the same heights. It lacks some other wxScrolled
617 features however, notably it can't scroll specific pixel sizes of the
618 window or its exact client area size.
619
620 To use this class, you need to derive from it and implement the
621 OnGetRowHeight() pure virtual method. You also must call SetRowCount() to
622 let the base class know how many rows it should display, but from that
623 moment on the scrolling is handled entirely by wxVScrolledWindow. You only
624 need to draw the visible part of contents in your @c OnPaint() method as
625 usual. You should use GetVisibleRowsBegin() and GetVisibleRowsEnd() to
626 select the lines to display. Note that the device context origin is not
627 shifted so the first visible row always appears at the point (0, 0) in
628 physical as well as logical coordinates.
629
630 @section wxWidgets 2.8 Compatibility Functions
631
632 The following functions provide backwards compatibility for applications
633 originally built using wxVScrolledWindow in 2.6 or 2.8. Originally,
634 wxVScrolledWindow referred to scrolling "lines". We now use "units" in
635 wxVarScrollHelperBase to avoid implying any orientation (since the
636 functions are used for both horizontal and vertical scrolling in derived
637 classes). And in the new wxVScrolledWindow and wxHScrolledWindow classes,
638 we refer to them as "rows" and "columns", respectively. This is to help
639 clear some confusion in not only those classes, but also in
640 wxHVScrolledWindow where functions are inherited from both.
641
642 You are encouraged to update any existing code using these function to use
643 the new replacements mentioned below, and avoid using these functions for
644 any new code as they are deprecated.
645
646 @beginTable
647 @row2col{ <tt>size_t %GetFirstVisibleLine() const</tt>,
648 Deprecated for GetVisibleRowsBegin(). }
649 @row2col{ <tt>size_t %GetLastVisibleLine() const</tt>,
650 Deprecated for GetVisibleRowsEnd(). This function originally had a
651 slight design flaw in that it was possible to return
652 <tt>(size_t)-1</tt> (ie: a large positive number) if the scroll
653 position was 0 and the first line wasn't completely visible. }
654 @row2col{ <tt>size_t %GetLineCount() const</tt>,
655 Deprecated for GetRowCount(). }
656 @row2col{ <tt>int %HitTest(wxCoord x\, wxCoord y) const
657 @n int %HitTest(const wxPoint& pt) const</tt>,
658 Deprecated for VirtualHitTest(). }
659 @row2col{ <tt>virtual wxCoord %OnGetLineHeight(size_t line) const</tt>,
660 Deprecated for OnGetRowHeight(). }
661 @row2col{ <tt>virtual void %OnGetLinesHint(size_t lineMin\, size_t lineMax) const</tt>,
662 Deprecated for OnGetRowsHeightHint(). }
663 @row2col{ <tt>virtual void %RefreshLine(size_t line)</tt>,
664 Deprecated for RefreshRow(). }
665 @row2col{ <tt>virtual void %RefreshLines(size_t from\, size_t to)</tt>,
666 Deprecated for RefreshRows(). }
667 @row2col{ <tt>virtual bool %ScrollLines(int lines)</tt>,
668 Deprecated for ScrollRows(). }
669 @row2col{ <tt>virtual bool %ScrollPages(int pages)</tt>,
670 Deprecated for ScrollRowPages(). }
671 @row2col{ <tt>bool %ScrollToLine(size_t line)</tt>,
672 Deprecated for ScrollToRow(). }
673 @row2col{ <tt>void %SetLineCount(size_t count)</tt>,
674 Deprecated for SetRowCount(). }
675 @endTable
676
677 @library{wxcore}
678 @category{miscwnd}
679
680 @see wxHScrolledWindow, wxHVScrolledWindow
681 */
682 class wxVScrolledWindow : public wxPanel, public wxVarVScrollHelper
683 {
684 public:
685 /**
686 Default constructor, you must call Create() later.
687 */
688 wxVScrolledWindow();
689 /**
690 This is the normal constructor, no need to call Create() after using
691 this constructor.
692
693 @note @c wxVSCROLL is always automatically added to the style, there is
694 no need to specify it explicitly.
695
696 @param parent
697 The parent window, must not be @NULL.
698 @param id
699 The identifier of this window, wxID_ANY by default.
700 @param pos
701 The initial window position.
702 @param size
703 The initial window size.
704 @param style
705 The window style. There are no special style bits defined for this
706 class.
707 @param name
708 The name for this window; usually not used.
709 */
710 wxVScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
711 const wxPoint& pos = wxDefaultPosition,
712 const wxSize& size = wxDefaultSize, long style = 0,
713 const wxString& name = wxPanelNameStr);
714
715 /**
716 Same as the non-default constuctor, but returns a status code: @true if
717 ok, @false if the window couldn't be created.
718
719 Just as with the constructor, the @c wxVSCROLL style is always used,
720 there is no need to specify it explicitly.
721 */
722 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
723 const wxPoint& pos = wxDefaultPosition,
724 const wxSize& size = wxDefaultSize, long style = 0,
725 const wxString& name = wxPanelNameStr);
726 };
727
728
729
730 /**
731 @class wxHScrolledWindow
732 @wxheader{vscroll.h}
733
734 In the name of this class, "H" stands for "horizontal" because it can be
735 used for scrolling columns of variable widths. It is not necessary to know
736 the widths of all columns in advance -- only those which are shown on the
737 screen need to be measured.
738
739 In any case, this is a generalization of wxScrolled which can be only used
740 when all columns have the same widths. It lacks some other wxScrolled
741 features however, notably it can't scroll specific pixel sizes of the
742 window or its exact client area size.
743
744 To use this class, you need to derive from it and implement the
745 OnGetColumnWidth() pure virtual method. You also must call SetColumnCount()
746 to let the base class know how many columns it should display, but from
747 that moment on the scrolling is handled entirely by wxHScrolledWindow. You
748 only need to draw the visible part of contents in your @c OnPaint() method
749 as usual. You should use GetVisibleColumnsBegin() and
750 GetVisibleColumnsEnd() to select the lines to display. Note that the device
751 context origin is not shifted so the first visible column always appears at
752 the point (0, 0) in physical as well as logical coordinates.
753
754 @library{wxcore}
755 @category{miscwnd}
756
757 @see wxHVScrolledWindow, wxVScrolledWindow
758 */
759 class wxHScrolledWindow : public wxPanel, public wxVarHScrollHelper
760 {
761 public:
762 /**
763 Default constructor, you must call Create() later.
764 */
765 wxHScrolledWindow();
766 /**
767 This is the normal constructor, no need to call Create() after using
768 this constructor.
769
770 @note @c wxHSCROLL is always automatically added to the style, there is
771 no need to specify it explicitly.
772
773 @param parent
774 The parent window, must not be @NULL.
775 @param id
776 The identifier of this window, wxID_ANY by default.
777 @param pos
778 The initial window position.
779 @param size
780 The initial window size.
781 @param style
782 The window style. There are no special style bits defined for this
783 class.
784 @param name
785 The name for this window; usually not used.
786 */
787 wxHScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
788 const wxPoint& pos = wxDefaultPosition,
789 const wxSize& size = wxDefaultSize, long style = 0,
790 const wxString& name = wxPanelNameStr);
791
792 /**
793 Same as the non-default constuctor, but returns a status code: @true if
794 ok, @false if the window couldn't be created.
795
796 Just as with the constructor, the @c wxHSCROLL style is always used,
797 there is no need to specify it explicitly.
798 */
799 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
800 const wxPoint& pos = wxDefaultPosition,
801 const wxSize& size = wxDefaultSize, long style = 0,
802 const wxString& name = wxPanelNameStr);
803 };
804
805
806
807 /**
808 @class wxHVScrolledWindow
809 @wxheader{vscroll.h}
810
811 This window inherits all functionality of both vertical and horizontal,
812 variable scrolled windows. It automatically handles everything needed to
813 scroll both axis simultaneously with both variable row heights and variable
814 column widths.
815
816 In any case, this is a generalization of wxScrolled which can be only used
817 when all rows and columns are the same size. It lacks some other wxScrolled
818 features however, notably it can't scroll specific pixel sizes of the
819 window or its exact client area size.
820
821 To use this class, you must derive from it and implement both the
822 OnGetRowHeight() and OnGetColumnWidth() pure virtual methods to let the
823 base class know how many rows and columns it should display. You also need
824 to set the total rows and columns the window contains, but from that moment
825 on the scrolling is handled entirely by wxHVScrolledWindow. You only need
826 to draw the visible part of contents in your @c OnPaint() method as usual.
827 You should use GetVisibleBegin() and GetVisibleEnd() to select the lines to
828 display. Note that the device context origin is not shifted so the first
829 visible row and column always appear at the point (0, 0) in physical as
830 well as logical coordinates.
831
832 @library{wxcore}
833 @category{miscwnd}
834
835 @see wxHScrolledWindow, wxVScrolledWindow
836 */
837 class wxHVScrolledWindow : public wxPanel, public wxVarHVScrollHelper
838 {
839 public:
840 /**
841 Default constructor, you must call Create() later.
842 */
843 wxHVScrolledWindow();
844 /**
845 This is the normal constructor, no need to call Create() after using
846 this constructor.
847
848 @note @c wxHSCROLL and @c wxVSCROLL are always automatically added to
849 the style, there is no need to specify it explicitly.
850
851 @param parent
852 The parent window, must not be @NULL.
853 @param id
854 The identifier of this window, wxID_ANY by default.
855 @param pos
856 The initial window position.
857 @param size
858 The initial window size.
859 @param style
860 The window style. There are no special style bits defined for this
861 class.
862 @param name
863 The name for this window; usually not used.
864 */
865 wxHVScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
866 const wxPoint& pos = wxDefaultPosition,
867 const wxSize& size = wxDefaultSize, long style = 0,
868 const wxString& name = wxPanelNameStr);
869
870 /**
871 Same as the non-default constuctor, but returns a status code: @true if
872 ok, @false if the window couldn't be created.
873
874 Just as with the constructor, the @c wxHSCROLL and @c wxVSCROLL styles
875 are always used, there is no need to specify them explicitly.
876 */
877 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
878 const wxPoint& pos = wxDefaultPosition,
879 const wxSize& size = wxDefaultSize, long style = 0,
880 const wxString& name = wxPanelNameStr);
881 };
882