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