1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface for wxPanel and wxScrolledWindow
7 // Created: 24-June-1997
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
21 //---------------------------------------------------------------------------
27 class wxPanel : public wxWindow
30 %pythonAppend wxPanel "self._setOORInfo(self)"
31 %pythonAppend wxPanel() ""
32 %typemap(out) wxPanel*; // turn off this typemap
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();
42 // Turn it back on again
43 %typemap(out) wxPanel* { $result = wxPyMake_wxObject($1, $owner); }
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);
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.
63 :see: `wx.FocusEvent`, `wx.Window.SetFocus`, `SetFocusIgnoringChildren`");
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
73 static wxVisualAttributes
74 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
77 //---------------------------------------------------------------------------
81 // TODO: Add wrappers for the wxScrollHelper class, make wxScrolledWindow
82 // derive from it and wxPanel. But what to do about wxGTK where this
85 MustHaveApp(wxScrolledWindow);
87 class wxScrolledWindow : public wxPanel
90 %pythonAppend wxScrolledWindow "self._setOORInfo(self)"
91 %pythonAppend wxScrolledWindow() ""
92 %typemap(out) wxScrolledWindow*; // turn off this typemap
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();
102 // Turn it back on again
103 %typemap(out) wxScrolledWindow* { $result = wxPyMake_wxObject($1, $owner); }
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);
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 );
119 // scroll to the given (in logical coords) position
120 virtual void Scroll(int x, int y);
122 // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL)
123 int GetScrollPageSize(int orient) const;
124 void SetScrollPageSize(int orient, int pageSize);
126 // Set the x, y scrolling increments.
127 void SetScrollRate( int xstep, int ystep );
130 virtual void, GetScrollPixelsPerUnit(int *OUTPUT, int *OUTPUT) const,
131 "GetScrollPixelsPerUnit() -> (xUnit, yUnit)",
132 "Get the size of one logical unit in physical units.", "");
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);
143 virtual void, GetViewStart(int *OUTPUT, int *OUTPUT) const,
144 "GetViewStart() -> (x,y)",
145 "Get the view start", "");
147 // Set the scale factor, used in PrepareDC
148 void SetScale(double xs, double ys);
149 double GetScaleX() const;
150 double GetScaleY() const;
153 %nokwargs CalcScrolledPosition;
154 %nokwargs CalcUnscrolledPosition;
156 DocStr(CalcScrolledPosition, "Translate between scrolled and unscrolled coordinates.", "");
157 wxPoint CalcScrolledPosition(const wxPoint& pt) const;
159 void, CalcScrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const,
160 "CalcScrolledPosition(int x, int y) -> (sx, sy)");
163 DocStr(CalcUnscrolledPosition, "Translate between scrolled and unscrolled coordinates.", "");
164 wxPoint CalcUnscrolledPosition(const wxPoint& pt) const;
166 void, CalcUnscrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const,
167 "CalcUnscrolledPosition(int x, int y) -> (ux, uy)");
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;
175 // Adjust the scrollbars
176 virtual void AdjustScrollbars();
178 // Calculate scroll increment
179 virtual int CalcScrollInc(wxScrollWinEvent& event);
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;
189 void SetTargetRect(const wxRect& rect);
190 wxRect GetTargetRect() const;
193 // TODO: directorize this?
195 virtual void , DoPrepareDC( wxDC & dc ),
196 "Normally what is called by `PrepareDC`.", "");
199 static wxVisualAttributes
200 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
204 //---------------------------------------------------------------------------