]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _window.i | |
3 | // Purpose: SWIG interface for wxPanel and wxScrolledWindow | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 24-June-1997 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | ||
18 | %{ | |
19 | %} | |
20 | ||
d14a1e28 RD |
21 | //--------------------------------------------------------------------------- |
22 | %newgroup | |
23 | ||
24 | ||
25 | class wxPanel : public wxWindow | |
26 | { | |
27 | public: | |
2b9048c5 RD |
28 | %pythonAppend wxPanel "self._setOORInfo(self)" |
29 | %pythonAppend wxPanel() "" | |
d14a1e28 RD |
30 | |
31 | wxPanel(wxWindow* parent, | |
dd9f7fea | 32 | const wxWindowID id=-1, |
d14a1e28 RD |
33 | const wxPoint& pos = wxDefaultPosition, |
34 | const wxSize& size = wxDefaultSize, | |
35 | long style = wxTAB_TRAVERSAL | wxNO_BORDER, | |
36 | const wxString& name = wxPyPanelNameStr); | |
37 | %name(PrePanel)wxPanel(); | |
38 | ||
39 | bool Create(wxWindow* parent, | |
2c65dbc4 | 40 | const wxWindowID id=-1, |
d14a1e28 RD |
41 | const wxPoint& pos = wxDefaultPosition, |
42 | const wxSize& size = wxDefaultSize, | |
43 | long style = wxTAB_TRAVERSAL | wxNO_BORDER, | |
44 | const wxString& name = wxPyPanelNameStr); | |
45 | ||
46 | void InitDialog(); | |
47 | ||
48 | }; | |
49 | ||
50 | //--------------------------------------------------------------------------- | |
51 | %newgroup | |
52 | ||
53 | ||
54 | // TODO: Add wrappers for the wxScrollHelper class, make wxScrolledWindow | |
55 | // derive from it and wxPanel. But what to do about wxGTK where this | |
dd9f7fea | 56 | // is not True? |
d14a1e28 RD |
57 | |
58 | class wxScrolledWindow : public wxPanel | |
59 | { | |
60 | public: | |
2b9048c5 RD |
61 | %pythonAppend wxScrolledWindow "self._setOORInfo(self)" |
62 | %pythonAppend wxScrolledWindow() "" | |
d14a1e28 RD |
63 | |
64 | wxScrolledWindow(wxWindow* parent, | |
65 | const wxWindowID id = -1, | |
66 | const wxPoint& pos = wxDefaultPosition, | |
67 | const wxSize& size = wxDefaultSize, | |
68 | long style = wxHSCROLL | wxVSCROLL, | |
69 | const wxString& name = wxPyPanelNameStr); | |
70 | %name(PreScrolledWindow)wxScrolledWindow(); | |
71 | ||
72 | bool Create(wxWindow* parent, | |
73 | const wxWindowID id = -1, | |
74 | const wxPoint& pos = wxDefaultPosition, | |
75 | const wxSize& size = wxDefaultSize, | |
76 | long style = wxHSCROLL | wxVSCROLL, | |
77 | const wxString& name = wxPyPanelNameStr); | |
78 | ||
79 | ||
80 | // configure the scrolling | |
81 | virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, | |
82 | int noUnitsX, int noUnitsY, | |
83 | int xPos = 0, int yPos = 0, | |
dd9f7fea | 84 | bool noRefresh = False ); |
d14a1e28 RD |
85 | |
86 | // scroll to the given (in logical coords) position | |
87 | virtual void Scroll(int x, int y); | |
88 | ||
89 | // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL) | |
90 | int GetScrollPageSize(int orient) const; | |
91 | void SetScrollPageSize(int orient, int pageSize); | |
92 | ||
93 | // Set the x, y scrolling increments. | |
94 | void SetScrollRate( int xstep, int ystep ); | |
95 | ||
322913ce RD |
96 | DocDeclAStr( |
97 | virtual void, GetScrollPixelsPerUnit(int *OUTPUT, int *OUTPUT) const, | |
98 | "GetScrollPixelsPerUnit() -> (xUnit, yUnit)", | |
99 | "Get the size of one logical unit in physical units."); | |
d14a1e28 | 100 | |
dd9f7fea | 101 | // Enable/disable Windows scrolling in either direction. If True, wxWindows |
d14a1e28 | 102 | // scrolls the canvas and only a bit of the canvas is invalidated; no |
dd9f7fea | 103 | // Clear() is necessary. If False, the whole canvas is invalidated and a |
d14a1e28 RD |
104 | // Clear() is necessary. Disable for when the scroll increment is used to |
105 | // actually scroll a non-constant distance | |
106 | virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); | |
107 | ||
d14a1e28 | 108 | |
322913ce RD |
109 | DocDeclAStr( |
110 | virtual void, GetViewStart(int *OUTPUT, int *OUTPUT) const, | |
111 | "GetViewStart() -> (x,y)", | |
112 | "Get the view start"); | |
113 | ||
d14a1e28 RD |
114 | // Set the scale factor, used in PrepareDC |
115 | void SetScale(double xs, double ys); | |
116 | double GetScaleX() const; | |
117 | double GetScaleY() const; | |
118 | ||
119 | ||
120 | %nokwargs CalcScrolledPosition; | |
121 | %nokwargs CalcUnscrolledPosition; | |
122 | ||
322913ce | 123 | DocStr(CalcScrolledPosition, "Translate between scrolled and unscrolled coordinates."); |
d14a1e28 | 124 | wxPoint CalcScrolledPosition(const wxPoint& pt) const; |
322913ce RD |
125 | DocDeclA( |
126 | void, CalcScrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const, | |
127 | "CalcScrolledPosition(int x, int y) -> (sx, sy)"); | |
128 | ||
129 | ||
130 | DocStr(CalcUnscrolledPosition, "Translate between scrolled and unscrolled coordinates."); | |
d14a1e28 | 131 | wxPoint CalcUnscrolledPosition(const wxPoint& pt) const; |
322913ce RD |
132 | DocDeclA( |
133 | void, CalcUnscrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const, | |
134 | "CalcUnscrolledPosition(int x, int y) -> (ux, uy)"); | |
d14a1e28 | 135 | |
322913ce RD |
136 | |
137 | ||
d14a1e28 RD |
138 | // TODO: use directors? |
139 | // virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const; | |
140 | // virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; | |
141 | ||
142 | // Adjust the scrollbars | |
143 | virtual void AdjustScrollbars(); | |
144 | ||
145 | // Calculate scroll increment | |
146 | virtual int CalcScrollInc(wxScrollWinEvent& event); | |
147 | ||
148 | // Normally the wxScrolledWindow will scroll itself, but in some rare | |
149 | // occasions you might want it to scroll [part of] another window (e.g. a | |
150 | // child of it in order to scroll only a portion the area between the | |
151 | // scrollbars (spreadsheet: only cell area will move). | |
152 | virtual void SetTargetWindow(wxWindow *target); | |
153 | virtual wxWindow *GetTargetWindow() const; | |
154 | ||
155 | #ifndef __WXGTK__ | |
156 | void SetTargetRect(const wxRect& rect); | |
157 | wxRect GetTargetRect() const; | |
158 | #endif | |
159 | }; | |
160 | ||
161 | ||
162 | //--------------------------------------------------------------------------- |