]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/scrolwin.h
f95ef798e2971bc39ad04868541d61894a57985e
[wxWidgets.git] / include / wx / gtk / scrolwin.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/scrolwin.h
3 // Purpose: wxScrolledWindow class
4 // Author: Robert Roebling
5 // Modified by: Vadim Zeitlin (2005-10-10): wxScrolledWindow is now common
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GTK_SCROLLWIN_H_
13 #define _WX_GTK_SCROLLWIN_H_
14
15 // ----------------------------------------------------------------------------
16 // wxScrolledWindow
17 // ----------------------------------------------------------------------------
18
19 class WXDLLIMPEXP_CORE wxScrollHelper : public wxScrollHelperBase
20 {
21 public:
22 // default ctor doesn't do anything
23 wxScrollHelper(wxWindow *win) : wxScrollHelperBase(win) { }
24
25 // implement the base class methods
26 virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
27 int noUnitsX, int noUnitsY,
28 int xPos = 0, int yPos = 0,
29 bool noRefresh = false);
30 virtual void AdjustScrollbars();
31
32 protected:
33 virtual void DoScroll(int x, int y);
34 virtual void DoShowScrollbars(wxScrollbarVisibility horz,
35 wxScrollbarVisibility vert);
36
37 private:
38 // this does (each) half of AdjustScrollbars() work
39 void DoAdjustScrollbar(GtkRange* range,
40 int pixelsPerLine,
41 int winSize,
42 int virtSize,
43 int *pos,
44 int *lines,
45 int *linesPerPage);
46
47 void DoAdjustHScrollbar(int winSize, int virtSize)
48 {
49 DoAdjustScrollbar
50 (
51 m_win->m_scrollBar[wxWindow::ScrollDir_Horz],
52 m_xScrollPixelsPerLine, winSize, virtSize,
53 &m_xScrollPosition, &m_xScrollLines, &m_xScrollLinesPerPage
54 );
55 }
56
57 void DoAdjustVScrollbar(int winSize, int virtSize)
58 {
59 DoAdjustScrollbar
60 (
61 m_win->m_scrollBar[wxWindow::ScrollDir_Vert],
62 m_yScrollPixelsPerLine, winSize, virtSize,
63 &m_yScrollPosition, &m_yScrollLines, &m_yScrollLinesPerPage
64 );
65 }
66
67 // and this does the same for Scroll()
68 void DoScrollOneDir(int orient,
69 int pos,
70 int pixelsPerLine,
71 int *posOld);
72
73 private:
74 DECLARE_NO_COPY_CLASS(wxScrollHelper)
75 };
76
77 #endif // _WX_GTK_SCROLLWIN_H_
78