]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/scrolwin.h
indentation fixes; virtual dtor for all platforms, not only MacOS X
[wxWidgets.git] / include / wx / gtk / scrolwin.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/scrolwin.h
3 // Purpose: wxScrolledWindow class
4 // Author: Robert Roebling
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GTK_SCROLLWIN_H_
13 #define _WX_GTK_SCROLLWIN_H_
14
15 #ifdef __GNUG__
16 #pragma interface "scrolwin.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // headers and constants
21 // ----------------------------------------------------------------------------
22
23 #include "wx/window.h"
24 #include "wx/panel.h"
25
26 WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
27
28 // default scrolled window style
29 #define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
30
31 // ----------------------------------------------------------------------------
32 // wxScrolledWindow
33 // ----------------------------------------------------------------------------
34
35 class WXDLLEXPORT wxScrolledWindow : public wxPanel
36 {
37 public:
38 wxScrolledWindow();
39 wxScrolledWindow(wxWindow *parent,
40 wxWindowID id = -1,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = wxScrolledWindowStyle,
44 const wxString& name = wxPanelNameStr)
45 {
46 Create(parent, id, pos, size, style, name);
47 }
48
49 ~wxScrolledWindow();
50
51 bool Create(wxWindow *parent,
52 wxWindowID id,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = wxScrolledWindowStyle,
56 const wxString& name = wxPanelNameStr);
57
58 // Normally the wxScrolledWindow will scroll itself, but in
59 // some rare occasions you might want it to scroll another
60 // window (e.g. a child of it in order to scroll only a portion
61 // the area between the scrollbars (spreadsheet: only cell area
62 // will move).
63 virtual void SetTargetWindow( wxWindow *target );
64 virtual wxWindow *GetTargetWindow();
65
66 // Number of pixels per user unit (0 or -1 for no scrollbar)
67 // Length of virtual canvas in user units
68 // Length of page in user units
69 virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
70 int noUnitsX, int noUnitsY,
71 int xPos = 0, int yPos = 0,
72 bool noRefresh = FALSE );
73
74 // Physically scroll the window
75 virtual void Scroll(int x_pos, int y_pos);
76
77 int GetScrollPageSize(int orient) const;
78 void SetScrollPageSize(int orient, int pageSize);
79
80 virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
81
82 // Enable/disable Windows scrolling in either direction.
83 // If TRUE, wxWindows scrolls the canvas and only a bit of
84 // the canvas is invalidated; no Clear() is necessary.
85 // If FALSE, the whole canvas is invalidated and a Clear() is
86 // necessary. Disable for when the scroll increment is used
87 // to actually scroll a non-constant distance
88 virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
89
90 // Get the view start
91 virtual void GetViewStart(int *x, int *y) const;
92 // Compatibility
93 void ViewStart(int *x, int *y) const
94 { GetViewStart( x, y ); }
95
96 // Actual size in pixels when scrolling is taken into account
97 virtual void GetVirtualSize(int *x, int *y) const;
98
99 virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const;
100 virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
101
102 // Override this function to draw the graphic (or just process EVT_PAINT)
103 virtual void OnDraw(wxDC& WXUNUSED(dc)) {}
104
105 // Override this function if you don't want to have wxScrolledWindow
106 // automatically change the origin according to the scroll position.
107 virtual void PrepareDC(wxDC& dc);
108
109 // Adjust the scrollbars
110 virtual void AdjustScrollbars();
111
112 // implementation from now on
113 void OnSize(wxSizeEvent& event);
114 void OnPaint(wxPaintEvent& event);
115 void OnChar(wxKeyEvent& event);
116
117 void GtkVScroll( float value );
118 void GtkHScroll( float value );
119
120 protected:
121 wxWindow *m_targetWindow;
122 int m_xScrollPixelsPerLine;
123 int m_yScrollPixelsPerLine;
124 bool m_xScrollingEnabled;
125 bool m_yScrollingEnabled;
126 int m_xScrollPosition;
127 int m_yScrollPosition;
128 int m_xScrollLines;
129 int m_yScrollLines;
130 int m_xScrollLinesPerPage;
131 int m_yScrollLinesPerPage;
132
133 private:
134 DECLARE_EVENT_TABLE()
135 DECLARE_ABSTRACT_CLASS(wxScrolledWindow)
136 };
137
138 #endif
139 // _WX_GTK_SCROLLWIN_H_