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