]>
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 | ||
ab1f7d2a RD |
25 | MustHaveApp(wxPanel); |
26 | ||
d14a1e28 RD |
27 | class wxPanel : public wxWindow |
28 | { | |
29 | public: | |
2b9048c5 RD |
30 | %pythonAppend wxPanel "self._setOORInfo(self)" |
31 | %pythonAppend wxPanel() "" | |
b39c3fa0 | 32 | %typemap(out) wxPanel*; // turn off this typemap |
d14a1e28 RD |
33 | |
34 | wxPanel(wxWindow* parent, | |
dd9f7fea | 35 | const wxWindowID id=-1, |
d14a1e28 RD |
36 | const wxPoint& pos = wxDefaultPosition, |
37 | const wxSize& size = wxDefaultSize, | |
38 | long style = wxTAB_TRAVERSAL | wxNO_BORDER, | |
39 | const wxString& name = wxPyPanelNameStr); | |
1b8c7ba6 | 40 | %RenameCtor(PrePanel, wxPanel()); |
d14a1e28 | 41 | |
b39c3fa0 RD |
42 | // Turn it back on again |
43 | %typemap(out) wxPanel* { $result = wxPyMake_wxObject($1, $owner); } | |
44 | ||
d14a1e28 | 45 | bool Create(wxWindow* parent, |
2c65dbc4 | 46 | const wxWindowID id=-1, |
d14a1e28 RD |
47 | const wxPoint& pos = wxDefaultPosition, |
48 | const wxSize& size = wxDefaultSize, | |
49 | long style = wxTAB_TRAVERSAL | wxNO_BORDER, | |
50 | const wxString& name = wxPyPanelNameStr); | |
51 | ||
52 | void InitDialog(); | |
53 | ||
ed8d127e RD |
54 | |
55 | DocDeclStr( | |
56 | virtual void , SetFocus(), | |
3ed2b503 RD |
57 | "Overrides `wx.Window.SetFocus`. This method uses the (undocumented) |
58 | mix-in class wxControlContainer which manages the focus and TAB logic | |
59 | for controls which usually have child controls. In practice, if you | |
60 | call this method and the panel has at least one child window, then the | |
61 | focus will be given to the child window.", " | |
ed8d127e RD |
62 | :see: `wx.FocusEvent`, `wx.Window.SetFocus`, `SetFocusIgnoringChildren`"); |
63 | ||
64 | ||
65 | DocDeclStr( | |
66 | virtual void , SetFocusIgnoringChildren(), | |
67 | "In contrast to `SetFocus` (see above) this will set the focus to the | |
68 | panel even of there are child windows in the panel. This is only | |
69 | rarely needed.", ""); | |
70 | ||
71 | ||
880715c9 RD |
72 | static wxVisualAttributes |
73 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
d14a1e28 RD |
74 | }; |
75 | ||
76 | //--------------------------------------------------------------------------- | |
77 | %newgroup | |
78 | ||
79 | ||
80 | // TODO: Add wrappers for the wxScrollHelper class, make wxScrolledWindow | |
81 | // derive from it and wxPanel. But what to do about wxGTK where this | |
dd9f7fea | 82 | // is not True? |
d14a1e28 | 83 | |
ab1f7d2a RD |
84 | MustHaveApp(wxScrolledWindow); |
85 | ||
d14a1e28 RD |
86 | class wxScrolledWindow : public wxPanel |
87 | { | |
88 | public: | |
2b9048c5 RD |
89 | %pythonAppend wxScrolledWindow "self._setOORInfo(self)" |
90 | %pythonAppend wxScrolledWindow() "" | |
b39c3fa0 | 91 | %typemap(out) wxScrolledWindow*; // turn off this typemap |
d14a1e28 RD |
92 | |
93 | wxScrolledWindow(wxWindow* parent, | |
94 | const wxWindowID id = -1, | |
95 | const wxPoint& pos = wxDefaultPosition, | |
96 | const wxSize& size = wxDefaultSize, | |
97 | long style = wxHSCROLL | wxVSCROLL, | |
98 | const wxString& name = wxPyPanelNameStr); | |
1b8c7ba6 | 99 | %RenameCtor(PreScrolledWindow, wxScrolledWindow()); |
d14a1e28 | 100 | |
b39c3fa0 RD |
101 | // Turn it back on again |
102 | %typemap(out) wxScrolledWindow* { $result = wxPyMake_wxObject($1, $owner); } | |
103 | ||
d14a1e28 RD |
104 | bool Create(wxWindow* parent, |
105 | const wxWindowID id = -1, | |
106 | const wxPoint& pos = wxDefaultPosition, | |
107 | const wxSize& size = wxDefaultSize, | |
108 | long style = wxHSCROLL | wxVSCROLL, | |
109 | const wxString& name = wxPyPanelNameStr); | |
110 | ||
111 | ||
112 | // configure the scrolling | |
113 | virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, | |
114 | int noUnitsX, int noUnitsY, | |
115 | int xPos = 0, int yPos = 0, | |
a72f4631 | 116 | bool noRefresh = false ); |
d14a1e28 RD |
117 | |
118 | // scroll to the given (in logical coords) position | |
119 | virtual void Scroll(int x, int y); | |
120 | ||
121 | // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL) | |
122 | int GetScrollPageSize(int orient) const; | |
123 | void SetScrollPageSize(int orient, int pageSize); | |
124 | ||
be601ceb RD |
125 | // // get the number of lines the window can scroll, |
126 | // // returns 0 if no scrollbars are there. | |
127 | // int GetScrollLines( int orient ) const; | |
128 | ||
d14a1e28 RD |
129 | // Set the x, y scrolling increments. |
130 | void SetScrollRate( int xstep, int ystep ); | |
131 | ||
322913ce RD |
132 | DocDeclAStr( |
133 | virtual void, GetScrollPixelsPerUnit(int *OUTPUT, int *OUTPUT) const, | |
134 | "GetScrollPixelsPerUnit() -> (xUnit, yUnit)", | |
d07d2bc9 | 135 | "Get the size of one logical unit in physical units.", ""); |
d14a1e28 | 136 | |
dd9f7fea | 137 | // Enable/disable Windows scrolling in either direction. If True, wxWindows |
d14a1e28 | 138 | // scrolls the canvas and only a bit of the canvas is invalidated; no |
dd9f7fea | 139 | // Clear() is necessary. If False, the whole canvas is invalidated and a |
d14a1e28 RD |
140 | // Clear() is necessary. Disable for when the scroll increment is used to |
141 | // actually scroll a non-constant distance | |
142 | virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); | |
143 | ||
d14a1e28 | 144 | |
322913ce RD |
145 | DocDeclAStr( |
146 | virtual void, GetViewStart(int *OUTPUT, int *OUTPUT) const, | |
147 | "GetViewStart() -> (x,y)", | |
d07d2bc9 | 148 | "Get the view start", ""); |
322913ce | 149 | |
d14a1e28 RD |
150 | // Set the scale factor, used in PrepareDC |
151 | void SetScale(double xs, double ys); | |
152 | double GetScaleX() const; | |
153 | double GetScaleY() const; | |
154 | ||
155 | ||
156 | %nokwargs CalcScrolledPosition; | |
157 | %nokwargs CalcUnscrolledPosition; | |
158 | ||
d07d2bc9 | 159 | DocStr(CalcScrolledPosition, "Translate between scrolled and unscrolled coordinates.", ""); |
d14a1e28 | 160 | wxPoint CalcScrolledPosition(const wxPoint& pt) const; |
322913ce RD |
161 | DocDeclA( |
162 | void, CalcScrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const, | |
163 | "CalcScrolledPosition(int x, int y) -> (sx, sy)"); | |
164 | ||
165 | ||
d07d2bc9 | 166 | DocStr(CalcUnscrolledPosition, "Translate between scrolled and unscrolled coordinates.", ""); |
d14a1e28 | 167 | wxPoint CalcUnscrolledPosition(const wxPoint& pt) const; |
322913ce RD |
168 | DocDeclA( |
169 | void, CalcUnscrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const, | |
170 | "CalcUnscrolledPosition(int x, int y) -> (ux, uy)"); | |
d14a1e28 | 171 | |
322913ce RD |
172 | |
173 | ||
d14a1e28 RD |
174 | // TODO: use directors? |
175 | // virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const; | |
176 | // virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; | |
177 | ||
178 | // Adjust the scrollbars | |
179 | virtual void AdjustScrollbars(); | |
180 | ||
181 | // Calculate scroll increment | |
182 | virtual int CalcScrollInc(wxScrollWinEvent& event); | |
183 | ||
184 | // Normally the wxScrolledWindow will scroll itself, but in some rare | |
185 | // occasions you might want it to scroll [part of] another window (e.g. a | |
186 | // child of it in order to scroll only a portion the area between the | |
187 | // scrollbars (spreadsheet: only cell area will move). | |
188 | virtual void SetTargetWindow(wxWindow *target); | |
189 | virtual wxWindow *GetTargetWindow() const; | |
190 | ||
191 | #ifndef __WXGTK__ | |
192 | void SetTargetRect(const wxRect& rect); | |
193 | wxRect GetTargetRect() const; | |
194 | #endif | |
880715c9 | 195 | |
3a9d4088 RD |
196 | // TODO: directorize this? |
197 | DocDeclStr( | |
198 | virtual void , DoPrepareDC( wxDC & dc ), | |
199 | "Normally what is called by `PrepareDC`.", ""); | |
200 | ||
201 | ||
880715c9 RD |
202 | static wxVisualAttributes |
203 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
7012bb9f RD |
204 | |
205 | %property(ScaleX, GetScaleX, doc="See `GetScaleX`"); | |
206 | %property(ScaleY, GetScaleY, doc="See `GetScaleY`"); | |
207 | %property(TargetWindow, GetTargetWindow, SetTargetWindow, doc="See `GetTargetWindow` and `SetTargetWindow`"); | |
208 | %property(ViewStart, GetViewStart, doc="See `GetViewStart`"); | |
d14a1e28 RD |
209 | }; |
210 | ||
211 | ||
212 | //--------------------------------------------------------------------------- |