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: scrolwin.h 43795 2006-12-04 11:05:59Z VZ $
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 WXDLLEXPORT wxScrollHelperNative : public wxScrollHelper
20 {
21 public:
22     // default ctor doesn't do anything
wxScrollHelperNative(wxWindow * win)23     wxScrollHelperNative(wxWindow *win) : wxScrollHelper(win) { }
24 
25     virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
26                                int noUnitsX, int noUnitsY,
27                                int xPos = 0, int yPos = 0,
28                                bool noRefresh = false);
29     virtual void AdjustScrollbars();
30     virtual void Scroll(int x, int y);
31 
32 protected:
33     // this does (each) half of AdjustScrollbars() work
34     void DoAdjustScrollbar(GtkRange* range,
35                            int pixelsPerLine,
36                            int winSize,
37                            int virtSize,
38                            int *pos,
39                            int *lines,
40                            int *linesPerPage);
41 
DoAdjustHScrollbar(int winSize,int virtSize)42     void DoAdjustHScrollbar(int winSize, int virtSize)
43     {
44         DoAdjustScrollbar
45         (
46             m_win->m_scrollBar[wxWindow::ScrollDir_Horz],
47             m_xScrollPixelsPerLine, winSize, virtSize,
48             &m_xScrollPosition, &m_xScrollLines, &m_xScrollLinesPerPage
49         );
50     }
51 
DoAdjustVScrollbar(int winSize,int virtSize)52     void DoAdjustVScrollbar(int winSize, int virtSize)
53     {
54         DoAdjustScrollbar
55         (
56             m_win->m_scrollBar[wxWindow::ScrollDir_Vert],
57             m_yScrollPixelsPerLine, winSize, virtSize,
58             &m_yScrollPosition, &m_yScrollLines, &m_yScrollLinesPerPage
59         );
60     }
61 
62     // and this does the same for Scroll()
63     void DoScroll(int orient,
64                   int pos,
65                   int pixelsPerLine,
66                   int *posOld);
67 
68 private:
69     DECLARE_NO_COPY_CLASS(wxScrollHelperNative)
70 };
71 
72 #endif // _WX_GTK_SCROLLWIN_H_
73 
74