]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_panel.i
Add Resize, SetRGBRect, Size, and GetOrFindMaskColour methods to wx.Image
[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 %RenameCtor(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 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.", "
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
72 static wxVisualAttributes
73 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
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
82 // is not True?
83
84 MustHaveApp(wxScrolledWindow);
85
86 class wxScrolledWindow : public wxPanel
87 {
88 public:
89 %pythonAppend wxScrolledWindow "self._setOORInfo(self)"
90 %pythonAppend wxScrolledWindow() ""
91 %typemap(out) wxScrolledWindow*; // turn off this typemap
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);
99 %RenameCtor(PreScrolledWindow, wxScrolledWindow());
100
101 // Turn it back on again
102 %typemap(out) wxScrolledWindow* { $result = wxPyMake_wxObject($1, $owner); }
103
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,
116 bool noRefresh = false );
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
125 // Set the x, y scrolling increments.
126 void SetScrollRate( int xstep, int ystep );
127
128 DocDeclAStr(
129 virtual void, GetScrollPixelsPerUnit(int *OUTPUT, int *OUTPUT) const,
130 "GetScrollPixelsPerUnit() -> (xUnit, yUnit)",
131 "Get the size of one logical unit in physical units.", "");
132
133 // Enable/disable Windows scrolling in either direction. If True, wxWindows
134 // scrolls the canvas and only a bit of the canvas is invalidated; no
135 // Clear() is necessary. If False, the whole canvas is invalidated and a
136 // Clear() is necessary. Disable for when the scroll increment is used to
137 // actually scroll a non-constant distance
138 virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
139
140
141 DocDeclAStr(
142 virtual void, GetViewStart(int *OUTPUT, int *OUTPUT) const,
143 "GetViewStart() -> (x,y)",
144 "Get the view start", "");
145
146 // Set the scale factor, used in PrepareDC
147 void SetScale(double xs, double ys);
148 double GetScaleX() const;
149 double GetScaleY() const;
150
151
152 %nokwargs CalcScrolledPosition;
153 %nokwargs CalcUnscrolledPosition;
154
155 DocStr(CalcScrolledPosition, "Translate between scrolled and unscrolled coordinates.", "");
156 wxPoint CalcScrolledPosition(const wxPoint& pt) const;
157 DocDeclA(
158 void, CalcScrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const,
159 "CalcScrolledPosition(int x, int y) -> (sx, sy)");
160
161
162 DocStr(CalcUnscrolledPosition, "Translate between scrolled and unscrolled coordinates.", "");
163 wxPoint CalcUnscrolledPosition(const wxPoint& pt) const;
164 DocDeclA(
165 void, CalcUnscrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const,
166 "CalcUnscrolledPosition(int x, int y) -> (ux, uy)");
167
168
169
170 // TODO: use directors?
171 // virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
172 // virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
173
174 // Adjust the scrollbars
175 virtual void AdjustScrollbars();
176
177 // Calculate scroll increment
178 virtual int CalcScrollInc(wxScrollWinEvent& event);
179
180 // Normally the wxScrolledWindow will scroll itself, but in some rare
181 // occasions you might want it to scroll [part of] another window (e.g. a
182 // child of it in order to scroll only a portion the area between the
183 // scrollbars (spreadsheet: only cell area will move).
184 virtual void SetTargetWindow(wxWindow *target);
185 virtual wxWindow *GetTargetWindow() const;
186
187 #ifndef __WXGTK__
188 void SetTargetRect(const wxRect& rect);
189 wxRect GetTargetRect() const;
190 #endif
191
192 // TODO: directorize this?
193 DocDeclStr(
194 virtual void , DoPrepareDC( wxDC & dc ),
195 "Normally what is called by `PrepareDC`.", "");
196
197
198 static wxVisualAttributes
199 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
200 };
201
202
203 //---------------------------------------------------------------------------