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