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