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