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