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