]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: windows2.i | |
3 | // Purpose: SWIG definitions of MORE window classes | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 6/2/98 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
03e9bead | 13 | %module windows2 |
7bf85405 | 14 | |
03e9bead | 15 | %{ |
7bf85405 RD |
16 | #include "helpers.h" |
17 | #include <wx/grid.h> | |
18 | #include <wx/notebook.h> | |
9c039d08 | 19 | #include <wx/splitter.h> |
7bf85405 RD |
20 | %} |
21 | ||
22 | //---------------------------------------------------------------------- | |
23 | ||
24 | %include typemaps.i | |
25 | %include my_typemaps.i | |
26 | ||
27 | // Import some definitions of other classes, etc. | |
28 | %import _defs.i | |
29 | %import misc.i | |
30 | %import gdi.i | |
31 | %import windows.i | |
32 | %import controls.i | |
33 | %import events.i | |
34 | ||
9c039d08 RD |
35 | %pragma(python) code = "import wxp" |
36 | ||
7bf85405 RD |
37 | //--------------------------------------------------------------------------- |
38 | ||
39 | enum { | |
40 | wxGRID_TEXT_CTRL, | |
41 | wxGRID_HSCROLL, | |
42 | wxGRID_VSCROLL, | |
43 | }; | |
44 | ||
45 | ||
46 | ||
47 | class wxGridCell { | |
48 | public: | |
49 | wxString& GetTextValue(); | |
50 | void SetTextValue(const wxString& str); | |
51 | wxFont *GetFont(); | |
52 | void SetFont(wxFont *f); | |
53 | wxColour& GetTextColour(); | |
54 | void SetTextColour(const wxColour& colour); | |
55 | wxColour& GetBackgroundColour(); | |
56 | void SetBackgroundColour(const wxColour& colour); | |
57 | wxBrush *GetBackgroundBrush(); | |
58 | int GetAlignment(); | |
59 | void SetAlignment(int align); | |
60 | wxBitmap *GetCellBitmap(); | |
61 | void SetCellBitmap(wxBitmap *bitmap); | |
62 | }; | |
63 | ||
64 | ||
65 | ||
66 | ||
67 | ||
68 | class wxGrid : public wxPanel { | |
69 | public: | |
70 | wxGrid(wxWindow* parent, wxWindowID id, | |
71 | const wxPoint& pos=wxPyDefaultPosition, | |
72 | const wxSize& size=wxPyDefaultSize, | |
73 | long style=0, | |
74 | char* name="grid"); | |
75 | ||
9c039d08 RD |
76 | %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)" |
77 | ||
7bf85405 RD |
78 | void AdjustScrollbars(); |
79 | bool AppendCols(int n=1, bool updateLabels=TRUE); | |
80 | bool AppendRows(int n=1, bool updateLabels=TRUE); | |
81 | void BeginBatch(); | |
82 | bool CellHitTest(int x, int y, int *OUTPUT, int *OUTPUT); | |
83 | ||
84 | %addmethods { | |
85 | // TODO: For now we are just ignoring the initial cellValues | |
86 | // and widths. Add support for loading them from | |
87 | // Python sequence objects. | |
88 | bool CreateGrid(int rows, int cols, | |
89 | //PyObject* cellValues = NULL, | |
90 | //PyObject* widths = NULL, | |
91 | short defaultWidth = wxGRID_DEFAULT_CELL_WIDTH, | |
92 | short defaultHeight = wxGRID_DEFAULT_CELL_HEIGHT) { | |
93 | return self->CreateGrid(rows, cols, NULL, NULL, | |
94 | defaultWidth, defaultHeight); | |
95 | } | |
96 | } | |
97 | ||
98 | bool CurrentCellVisible(); | |
99 | bool DeleteCols(int pos=0, int n=1, bool updateLabels=TRUE); | |
100 | bool DeleteRows(int pos=0, int n=1, bool updateLabels=TRUE); | |
101 | void EndBatch(); | |
102 | ||
103 | int GetBatchCount(); | |
104 | wxGridCell* GetCell(int row, int col); | |
105 | int GetCellAlignment(int row, int col); | |
106 | %name(GetDefCellAlignment)int GetCellAlignment(); | |
107 | wxColour& GetCellBackgroundColour(int row, int col); | |
108 | %name(GetDefCellBackgroundColour) | |
109 | wxColour& GetCellBackgroundColour(); | |
110 | //wxGridCell *** GetCells(); | |
111 | wxColour& GetCellTextColour(int row, int col); | |
112 | %name(GetDefCellTextColour)wxColour& GetCellTextColour(); | |
113 | wxFont* GetCellTextFont(int row, int col); | |
114 | %name(GetDefCellTextFont)wxFont* GetCellTextFont(); | |
115 | wxString& GetCellValue(int row, int col); | |
116 | int GetCols(); | |
117 | int GetColumnWidth(int col); | |
118 | wxRect& GetCurrentRect(); | |
119 | int GetCursorColumn(); | |
120 | int GetCursorRow(); | |
121 | bool GetEditable(); | |
122 | wxScrollBar * GetHorizScrollBar(); | |
123 | int GetLabelAlignment(int orientation); | |
124 | wxColour& GetLabelBackgroundColour(); | |
125 | int GetLabelSize(int orientation); | |
126 | wxColour& GetLabelTextColour(); | |
127 | wxFont* GetLabelTextFont(); | |
128 | wxString& GetLabelValue(int orientation, int pos); | |
129 | int GetRowHeight(int row); | |
130 | int GetRows(); | |
131 | int GetScrollPosX(); | |
132 | int GetScrollPosY(); | |
133 | wxTextCtrl* GetTextItem(); | |
134 | wxScrollBar* GetVertScrollBar(); | |
135 | ||
136 | bool InsertCols(int pos=0, int n=1, bool updateLabels=TRUE); | |
137 | bool InsertRows(int pos=0, int n=1, bool updateLabels=TRUE); | |
138 | ||
139 | // TODO: How to handle callbacks that don't come from | |
140 | // event system??? | |
141 | // | |
142 | //void OnActivate(bool active); | |
143 | //void OnChangeLabels(); | |
144 | //void OnChangeSelectionLabel(); | |
145 | //wxGridCell* OnCreateCell(); | |
146 | //void OnLeftClick(int row, int col, int x, int y, bool control, bool shift); | |
147 | //void OnRightClick(int row, int col, int x, int y, bool control, bool shift); | |
148 | //void OnLabelLeftClick(int row, int col, int x, int y, bool control, bool shift); | |
149 | //void OnLabelRightClick(int row, int col, int x, int y, bool control, bool shift); | |
150 | //void OnSelectCell(int row, int col); | |
151 | //void OnSelectCellImplementation(wxDC *dc, int row, int col); | |
152 | ||
153 | void SetCellAlignment(int alignment, int row, int col); | |
154 | %name(SetDefCellAlignment)void SetCellAlignment(int alignment); | |
155 | void SetCellBackgroundColour(const wxColour& colour, int row, int col); | |
156 | %name(SetDefCellBackgroundColour) | |
157 | void SetCellBackgroundColour(const wxColour& colour); | |
158 | void SetCellTextColour(const wxColour& colour, int row, int col); | |
159 | %name(SetDefCellTextColour)void SetCellTextColour(const wxColour& colour); | |
160 | void SetCellTextFont(wxFont *font, int row, int col); | |
161 | %name(SetDefCellTextFont)void SetCellTextFont(wxFont *font); | |
162 | void SetCellValue(const wxString& val, int row, int col); | |
163 | void SetColumnWidth(int col, int width); | |
164 | void SetDividerPen(wxPen *pen); | |
165 | void SetEditable(bool editable); | |
166 | void SetGridCursor(int row, int col); | |
167 | void SetLabelAlignment(int orientation, int alignment); | |
168 | void SetLabelBackgroundColour(const wxColour& value); | |
169 | void SetLabelSize(int orientation, int size); | |
170 | void SetLabelTextColour(const wxColour& value); | |
171 | void SetLabelTextFont(wxFont *font); | |
172 | void SetLabelValue(int orientation, const wxString& value, int pos); | |
173 | void SetRowHeight(int row, int height); | |
174 | ||
175 | void UpdateDimensions(); | |
176 | }; | |
177 | ||
178 | //--------------------------------------------------------------------------- | |
179 | ||
180 | class wxNotebookEvent : public wxCommandEvent { | |
181 | public: | |
182 | int GetSelection(); | |
183 | int GetOldSelection(); | |
184 | }; | |
185 | ||
186 | ||
187 | ||
188 | class wxNotebook : public wxControl { | |
189 | public: | |
190 | wxNotebook(wxWindow *parent, | |
191 | wxWindowID id, | |
192 | const wxPoint& pos = wxPyDefaultPosition, | |
193 | const wxSize& size = wxPyDefaultSize, | |
194 | long style = 0, | |
195 | char* name = "notebook"); | |
196 | ||
9c039d08 RD |
197 | %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)" |
198 | ||
7bf85405 RD |
199 | int GetPageCount(); |
200 | int SetSelection(int nPage); | |
201 | void AdvanceSelection(bool bForward = TRUE); | |
202 | int GetSelection(); | |
203 | bool SetPageText(int nPage, const wxString& strText); | |
204 | wxString GetPageText(int nPage) const; | |
205 | void SetImageList(wxImageList* imageList); | |
206 | wxImageList* GetImageList(); | |
207 | int GetPageImage(int nPage); | |
208 | bool SetPageImage(int nPage, int nImage); | |
209 | int GetRowCount(); | |
210 | ||
211 | // LINK ERROR: void SetPageSize(const wxSize& size); | |
212 | // LINK ERROR: void SetPadding(const wxSize& padding); | |
213 | bool DeletePage(int nPage); | |
214 | bool DeleteAllPages(); | |
215 | bool AddPage(/*wxNotebookPage*/ wxWindow *pPage, | |
216 | const wxString& strText, | |
217 | bool bSelect = FALSE, | |
218 | int imageId = -1); | |
fb5e0af0 | 219 | #ifdef __WXMSW__ |
7bf85405 RD |
220 | bool InsertPage(int nPage, |
221 | /*wxNotebookPage*/ wxWindow *pPage, | |
222 | const wxString& strText, | |
223 | bool bSelect = FALSE, | |
224 | int imageId = -1); | |
fb5e0af0 | 225 | #endif |
7bf85405 RD |
226 | wxNotebookPage *GetPage(int nPage); |
227 | ||
228 | }; | |
229 | ||
9c039d08 RD |
230 | //--------------------------------------------------------------------------- |
231 | ||
232 | class wxSplitterWindow : public wxWindow { | |
233 | public: | |
234 | wxSplitterWindow(wxWindow* parent, wxWindowID id, | |
235 | const wxPoint& point = wxPyDefaultPosition, | |
236 | const wxSize& size = wxPyDefaultSize, | |
237 | long style=wxSP_3D, | |
238 | char* name = "splitterWindow"); | |
239 | ||
240 | %pragma(python) addtomethod = "__init__:wxp._StdWindowCallbacks(self)" | |
241 | ||
242 | int GetMinimumPaneSize(); | |
243 | int GetSashPosition(); | |
244 | int GetSplitMode(); | |
245 | wxWindow* GetWindow1(); | |
246 | wxWindow* GetWindow2(); | |
247 | void Initialize(wxWindow* window); | |
248 | bool IsSplit(); | |
249 | ||
250 | // TODO: How to handle callbacks that don't come from | |
251 | // event system??? | |
252 | // | |
253 | //void OnDoubleClickSash(int x, int y); | |
254 | //void OnUnsplit(wxWindow* removed); | |
255 | ||
256 | void SetSashPosition(int position, int redraw = TRUE); | |
257 | void SetMinimumPaneSize(int paneSize); | |
258 | void SetSplitMode(int mode); | |
259 | bool SplitHorizontally(wxWindow* window1, wxWindow* window2, int sashPosition = -1); | |
260 | bool SplitVertically(wxWindow* window1, wxWindow* window2, int sashPosition = -1); | |
261 | bool Unsplit(wxWindow* toRemove = NULL); | |
262 | }; | |
263 | ||
264 | //--------------------------------------------------------------------------- | |
265 | ||
266 | ||
267 | ||
7bf85405 RD |
268 | //--------------------------------------------------------------------------- |
269 | ///////////////////////////////////////////////////////////////////////////// | |
270 | // | |
271 | // $Log$ | |
9c039d08 RD |
272 | // Revision 1.4 1998/10/02 06:40:43 RD |
273 | // Version 0.4 of wxPython for MSW. | |
274 | // | |
fb5e0af0 RD |
275 | // Revision 1.3 1998/08/18 19:48:20 RD |
276 | // more wxGTK compatibility things. | |
277 | // | |
278 | // It builds now but there are serious runtime problems... | |
279 | // | |
03e9bead RD |
280 | // Revision 1.2 1998/08/15 07:36:50 RD |
281 | // - Moved the header in the .i files out of the code that gets put into | |
282 | // the .cpp files. It caused CVS conflicts because of the RCS ID being | |
283 | // different each time. | |
284 | // | |
285 | // - A few minor fixes. | |
286 | // | |
7bf85405 RD |
287 | // Revision 1.1 1998/08/09 08:25:52 RD |
288 | // Initial version | |
289 | // | |
290 | // |