]>
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); | |
40 | %name(PrePanel)wxPanel(); | |
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 | ||
880715c9 RD |
54 | static wxVisualAttributes |
55 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
d14a1e28 RD |
56 | }; |
57 | ||
58 | //--------------------------------------------------------------------------- | |
59 | %newgroup | |
60 | ||
61 | ||
62 | // TODO: Add wrappers for the wxScrollHelper class, make wxScrolledWindow | |
63 | // derive from it and wxPanel. But what to do about wxGTK where this | |
dd9f7fea | 64 | // is not True? |
d14a1e28 | 65 | |
ab1f7d2a RD |
66 | MustHaveApp(wxScrolledWindow); |
67 | ||
d14a1e28 RD |
68 | class wxScrolledWindow : public wxPanel |
69 | { | |
70 | public: | |
2b9048c5 RD |
71 | %pythonAppend wxScrolledWindow "self._setOORInfo(self)" |
72 | %pythonAppend wxScrolledWindow() "" | |
b39c3fa0 | 73 | %typemap(out) wxScrolledWindow*; // turn off this typemap |
d14a1e28 RD |
74 | |
75 | wxScrolledWindow(wxWindow* parent, | |
76 | const wxWindowID id = -1, | |
77 | const wxPoint& pos = wxDefaultPosition, | |
78 | const wxSize& size = wxDefaultSize, | |
79 | long style = wxHSCROLL | wxVSCROLL, | |
80 | const wxString& name = wxPyPanelNameStr); | |
81 | %name(PreScrolledWindow)wxScrolledWindow(); | |
82 | ||
b39c3fa0 RD |
83 | // Turn it back on again |
84 | %typemap(out) wxScrolledWindow* { $result = wxPyMake_wxObject($1, $owner); } | |
85 | ||
d14a1e28 RD |
86 | bool Create(wxWindow* parent, |
87 | const wxWindowID id = -1, | |
88 | const wxPoint& pos = wxDefaultPosition, | |
89 | const wxSize& size = wxDefaultSize, | |
90 | long style = wxHSCROLL | wxVSCROLL, | |
91 | const wxString& name = wxPyPanelNameStr); | |
92 | ||
93 | ||
94 | // configure the scrolling | |
95 | virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, | |
96 | int noUnitsX, int noUnitsY, | |
97 | int xPos = 0, int yPos = 0, | |
dd9f7fea | 98 | bool noRefresh = False ); |
d14a1e28 RD |
99 | |
100 | // scroll to the given (in logical coords) position | |
101 | virtual void Scroll(int x, int y); | |
102 | ||
103 | // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL) | |
104 | int GetScrollPageSize(int orient) const; | |
105 | void SetScrollPageSize(int orient, int pageSize); | |
106 | ||
107 | // Set the x, y scrolling increments. | |
108 | void SetScrollRate( int xstep, int ystep ); | |
109 | ||
322913ce RD |
110 | DocDeclAStr( |
111 | virtual void, GetScrollPixelsPerUnit(int *OUTPUT, int *OUTPUT) const, | |
112 | "GetScrollPixelsPerUnit() -> (xUnit, yUnit)", | |
d07d2bc9 | 113 | "Get the size of one logical unit in physical units.", ""); |
d14a1e28 | 114 | |
dd9f7fea | 115 | // Enable/disable Windows scrolling in either direction. If True, wxWindows |
d14a1e28 | 116 | // scrolls the canvas and only a bit of the canvas is invalidated; no |
dd9f7fea | 117 | // Clear() is necessary. If False, the whole canvas is invalidated and a |
d14a1e28 RD |
118 | // Clear() is necessary. Disable for when the scroll increment is used to |
119 | // actually scroll a non-constant distance | |
120 | virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); | |
121 | ||
d14a1e28 | 122 | |
322913ce RD |
123 | DocDeclAStr( |
124 | virtual void, GetViewStart(int *OUTPUT, int *OUTPUT) const, | |
125 | "GetViewStart() -> (x,y)", | |
d07d2bc9 | 126 | "Get the view start", ""); |
322913ce | 127 | |
d14a1e28 RD |
128 | // Set the scale factor, used in PrepareDC |
129 | void SetScale(double xs, double ys); | |
130 | double GetScaleX() const; | |
131 | double GetScaleY() const; | |
132 | ||
133 | ||
134 | %nokwargs CalcScrolledPosition; | |
135 | %nokwargs CalcUnscrolledPosition; | |
136 | ||
d07d2bc9 | 137 | DocStr(CalcScrolledPosition, "Translate between scrolled and unscrolled coordinates.", ""); |
d14a1e28 | 138 | wxPoint CalcScrolledPosition(const wxPoint& pt) const; |
322913ce RD |
139 | DocDeclA( |
140 | void, CalcScrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const, | |
141 | "CalcScrolledPosition(int x, int y) -> (sx, sy)"); | |
142 | ||
143 | ||
d07d2bc9 | 144 | DocStr(CalcUnscrolledPosition, "Translate between scrolled and unscrolled coordinates.", ""); |
d14a1e28 | 145 | wxPoint CalcUnscrolledPosition(const wxPoint& pt) const; |
322913ce RD |
146 | DocDeclA( |
147 | void, CalcUnscrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const, | |
148 | "CalcUnscrolledPosition(int x, int y) -> (ux, uy)"); | |
d14a1e28 | 149 | |
322913ce RD |
150 | |
151 | ||
d14a1e28 RD |
152 | // TODO: use directors? |
153 | // virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const; | |
154 | // virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; | |
155 | ||
156 | // Adjust the scrollbars | |
157 | virtual void AdjustScrollbars(); | |
158 | ||
159 | // Calculate scroll increment | |
160 | virtual int CalcScrollInc(wxScrollWinEvent& event); | |
161 | ||
162 | // Normally the wxScrolledWindow will scroll itself, but in some rare | |
163 | // occasions you might want it to scroll [part of] another window (e.g. a | |
164 | // child of it in order to scroll only a portion the area between the | |
165 | // scrollbars (spreadsheet: only cell area will move). | |
166 | virtual void SetTargetWindow(wxWindow *target); | |
167 | virtual wxWindow *GetTargetWindow() const; | |
168 | ||
169 | #ifndef __WXGTK__ | |
170 | void SetTargetRect(const wxRect& rect); | |
171 | wxRect GetTargetRect() const; | |
172 | #endif | |
880715c9 | 173 | |
3a9d4088 RD |
174 | // TODO: directorize this? |
175 | DocDeclStr( | |
176 | virtual void , DoPrepareDC( wxDC & dc ), | |
177 | "Normally what is called by `PrepareDC`.", ""); | |
178 | ||
179 | ||
880715c9 RD |
180 | static wxVisualAttributes |
181 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
d14a1e28 RD |
182 | }; |
183 | ||
184 | ||
185 | //--------------------------------------------------------------------------- |