]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: scrolwin.h | |
3 | // Purpose: wxScrolledWindow class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart and Markus Holzem | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __SCROLWINH_G__ | |
13 | #define __SCROLWINH_G__ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "scrolwin.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/window.h" | |
20 | ||
908d4516 | 21 | WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr; |
c801d85f KB |
22 | |
23 | class WXDLLEXPORT wxScrolledWindow: public wxWindow | |
24 | { | |
25 | DECLARE_ABSTRACT_CLASS(wxScrolledWindow) | |
26 | ||
27 | public: | |
c5b42c87 | 28 | wxScrolledWindow(); |
debe6624 | 29 | inline wxScrolledWindow(wxWindow *parent, wxWindowID id = -1, |
c801d85f KB |
30 | const wxPoint& pos = wxDefaultPosition, |
31 | const wxSize& size = wxDefaultSize, | |
debe6624 | 32 | long style = wxHSCROLL|wxVSCROLL, |
c801d85f KB |
33 | const wxString& name = wxPanelNameStr) |
34 | { | |
35 | Create(parent, id, pos, size, style, name); | |
36 | } | |
37 | ||
c5b42c87 | 38 | ~wxScrolledWindow() {} |
c801d85f | 39 | |
debe6624 | 40 | bool Create(wxWindow *parent, wxWindowID id, |
c801d85f KB |
41 | const wxPoint& pos = wxDefaultPosition, |
42 | const wxSize& size = wxDefaultSize, | |
debe6624 | 43 | long style = wxHSCROLL|wxVSCROLL, |
c801d85f KB |
44 | const wxString& name = wxPanelNameStr); |
45 | ||
46 | // Set client size | |
47 | // Should take account of scrollbars | |
debe6624 | 48 | // virtual void SetClientSize(int width, int size); |
c801d85f KB |
49 | |
50 | // Is the window retained? | |
51 | // inline bool IsRetained(void) const; | |
52 | ||
53 | // Number of pixels per user unit (0 or -1 for no scrollbar) | |
54 | // Length of virtual canvas in user units | |
55 | // Length of page in user units | |
debe6624 JS |
56 | virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, |
57 | int noUnitsX, int noUnitsY, | |
58 | int xPos = 0, int yPos = 0, | |
59 | bool noRefresh = FALSE ); | |
c801d85f KB |
60 | |
61 | // Physically scroll the window | |
debe6624 | 62 | virtual void Scroll(int x_pos, int y_pos); |
c801d85f KB |
63 | |
64 | #if WXWIN_COMPATIBILITY | |
65 | virtual void GetScrollUnitsPerPage(int *x_page, int *y_page) const; | |
66 | #endif | |
67 | ||
68 | int GetScrollPageSize(int orient) const ; | |
69 | void SetScrollPageSize(int orient, int pageSize); | |
70 | ||
71 | virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const; | |
72 | // Enable/disable Windows scrolling in either direction. | |
73 | // If TRUE, wxWindows scrolls the canvas and only a bit of | |
74 | // the canvas is invalidated; no Clear() is necessary. | |
75 | // If FALSE, the whole canvas is invalidated and a Clear() is | |
76 | // necessary. Disable for when the scroll increment is used | |
77 | // to actually scroll a non-constant distance | |
debe6624 | 78 | virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); |
c801d85f KB |
79 | |
80 | // Get the view start | |
81 | virtual void ViewStart(int *x, int *y) const; | |
82 | ||
83 | // Actual size in pixels when scrolling is taken into account | |
84 | virtual void GetVirtualSize(int *x, int *y) const; | |
85 | ||
0d8d91a9 JS |
86 | // Set the scale factor, used in PrepareDC |
87 | inline void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; } | |
88 | inline double GetScaleX() const { return m_scaleX; } | |
89 | inline double GetScaleY() const { return m_scaleY; } | |
90 | ||
debe6624 JS |
91 | virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const ; |
92 | virtual void CalcUnscrolledPosition(int x, int y, float *xx, float *yy) const ; | |
c801d85f KB |
93 | |
94 | // Adjust the scrollbars | |
95 | virtual void AdjustScrollbars(void); | |
96 | ||
c5b42c87 | 97 | void OnScroll(wxScrollWinEvent& event); |
c801d85f KB |
98 | void OnSize(wxSizeEvent& event); |
99 | void OnPaint(wxPaintEvent& event); | |
100 | ||
101 | // Override this function to draw the graphic. | |
102 | virtual void OnDraw(wxDC& WXUNUSED(dc)) {}; | |
103 | ||
104 | // Override this function if you don't want to have wxScrolledWindow | |
105 | // automatically change the origin according to the scroll position. | |
106 | virtual void PrepareDC(wxDC& dc); | |
107 | ||
108 | public: | |
c5b42c87 | 109 | // IMPLEMENTATION |
c801d85f KB |
110 | |
111 | // Calculate scroll increment | |
c5b42c87 | 112 | virtual int CalcScrollInc(wxScrollWinEvent& event); |
c801d85f | 113 | |
c801d85f KB |
114 | protected: |
115 | int m_xScrollPixelsPerLine; | |
116 | int m_yScrollPixelsPerLine; | |
117 | bool m_xScrollingEnabled; | |
118 | bool m_yScrollingEnabled; | |
119 | int m_xScrollPosition; | |
120 | int m_yScrollPosition; | |
121 | int m_xScrollLines; | |
122 | int m_yScrollLines; | |
123 | int m_xScrollLinesPerPage; | |
124 | int m_yScrollLinesPerPage; | |
0d8d91a9 JS |
125 | double m_scaleX; |
126 | double m_scaleY; | |
c801d85f KB |
127 | |
128 | DECLARE_EVENT_TABLE() | |
129 | }; | |
130 | ||
c801d85f KB |
131 | #endif |
132 | // __SCROLWINH_G__ |