Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 862 lines (694 sloc) 28.038 kB
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
1 /***********************************************************************
2 * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
b8219ec @lylejohnson Updated copyright notice for all SWIG interface files
lylejohnson authored
3 * Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * For further information please contact the author by e-mail
a934547 @lylejohnson Replaced e-mail address "lyle@users.sourceforge.net" with
lylejohnson authored
20 * at "lyle@lylejohnson.name".
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
21 ***********************************************************************/
22
23 class FXTable;
24
25 // Default cell margin
26 enum { DEFAULT_MARGIN = 2 };
27
28
29 /// Table options
30 enum {
31 TABLE_COL_SIZABLE = 0x00100000, /// Columns are resizable
32 TABLE_ROW_SIZABLE = 0x00200000, /// Rows are resizable
33 TABLE_NO_COLSELECT = 0x00400000, /// Disallow column selections
34 TABLE_NO_ROWSELECT = 0x00800000, /// Disallow row selections
35 TABLE_READONLY = 0x01000000, /// Table is NOT editable
36 TABLE_COL_RENUMBER = 0x02000000, /// Renumber columns
37 TABLE_ROW_RENUMBER = 0x04000000 /// Renumber rows
38 };
39
40
41 // Position in table
42 struct FXTablePos {
43 FXTablePos();
44 FXint row;
45 FXint col;
46 ~FXTablePos();
47 };
bea4cad @larskanis Strip all whitespaces on line endings
authored
48
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
49
50 // Range of table cells
51 struct FXTableRange {
52 FXTableRange();
53 FXTablePos fm;
54 FXTablePos to;
55 ~FXTableRange();
56 };
57
58
59 /// Item in table
60 class FXTableItem : public FXObject {
61 protected:
62 FXString label;
63 FXIcon *icon;
64 void *data;
65 FXuint state;
66 protected:
67 FXTableItem():icon(NULL),data(NULL),state(0){}
68 FXint textWidth(const FXTable* table) const;
69 FXint textHeight(const FXTable* table) const;
70 virtual void draw(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
71 virtual void drawBorders(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
72 virtual void drawContent(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
73 virtual void drawPattern(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
74 virtual void drawBackground(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
75 protected:
76 FXTableItem();
77 public:
bea4cad @larskanis Strip all whitespaces on line endings
authored
78 enum{
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
79 SELECTED = 0x00000001, /// Selected
80 FOCUS = 0x00000002, /// Focus
81 DISABLED = 0x00000004, /// Disabled
82 DRAGGABLE = 0x00000008, /// Draggable
83 RESERVED1 = 0x00000010, /// Reserved
84 RESERVED2 = 0x00000020, /// Reserved
85 ICONOWNED = 0x00000040, /// Icon owned by table item
86 RIGHT = 0x00002000, /// Align on right (default)
87 LEFT = 0x00004000, /// Align on left
88 CENTER_X = 0, /// Align centered horizontally
89 TOP = 0x00008000, /// Align on top
90 BOTTOM = 0x00010000, /// Align on bottom
91 CENTER_Y = 0, /// Align centered vertically (default)
92 BEFORE = 0x00020000, /// Icon before the text
93 AFTER = 0x00040000, /// Icon after the text
94 ABOVE = 0x00080000, /// Icon above the text
95 BELOW = 0x00100000, /// Icon below the text
96 LBORDER = 0x00200000, /// Draw left border
97 RBORDER = 0x00400000, /// Draw right border
98 TBORDER = 0x00800000, /// Draw top border
99 BBORDER = 0x01000000 /// Draw bottom border
100 };
101 public:
102 %extend {
103 // Construct new table item
104 FXTableItem(const FXString& text,FXIcon* ic=NULL,void* ITEMDATA=NULL){
105 return new FXRbTableItem(text,ic,ITEMDATA);
106 }
107 }
108
109 %extend {
110 // Change item's user data
111 void setData(VALUE ptr){
112 self->setData(reinterpret_cast<void*>(ptr));
113 }
114
115 // Get item's user data
116 VALUE getData() const {
117 return self->getData() ? reinterpret_cast<VALUE>(self->getData()) : Qnil;
118 }
119 }
bea4cad @larskanis Strip all whitespaces on line endings
authored
120
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
121 // Return true if item has focus
122 FXbool hasFocus() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
123
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
124 // Return true if item is selected
125 FXbool isSelected() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
126
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
127 // Return true if item is enabled
128 FXbool isEnabled() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
129
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
130 // Return true if item is draggable
131 FXbool isDraggable() const;
132
133 // Return item content justification
134 FXuint getJustify() const;
135
136 // Return item icon position
137 FXuint getIconPosition() const;
138
139 // Return item borders
140 FXuint getBorders() const;
141
142 // Return item background stipple
143 FXStipplePattern getStipple() const;
144
145 // Destructor
146 virtual ~FXTableItem();
147 };
148
149
150 DECLARE_FXOBJECT_VIRTUALS(FXTableItem)
151 DECLARE_FXTABLEITEM_VIRTUALS(FXTableItem)
152
153 // Enforce row numbers that are within bounds 0 <= row < numRows
154 %typemap(check) FXint TABLE_ROW_INDEX {
155 if ($1 < 0 || $1 >= arg1->getNumRows()) {
156 rb_raise(rb_eIndexError, "table row out of bounds");
157 }
158 }
159
160 // Enforce row numbers that are within bounds 0 <= row <= numRows
161 %typemap(check) FXint TABLE_ROW_ALL {
162 if ($1 < 0 || $1 > arg1->getNumRows()) {
163 rb_raise(rb_eIndexError, "table row out of bounds");
164 }
165 }
166
167 // Enforce row = 0 or row = 1 only
168 %typemap(check) FXint ROW_ZERO_OR_ONE {
169 if ($1 != 0 && $1 != 1) {
170 rb_raise(rb_eIndexError, "table row out of bounds");
171 }
172 }
173
174 // Special for removeRows()
175 %typemap(check) (FXint row,FXint nr) {
176 if ($1 < 0 || $1 + $2 > arg1->getNumRows()) {
177 rb_raise(rb_eIndexError,"table row out of bounds");
178 }
179 }
180
181 // Enforce column numbers that are within bounds 0 <= column < numColumns
182 %typemap(check) FXint TABLE_COLUMN_INDEX {
183 if ($1 < 0 || $1 >= arg1->getNumColumns()) {
184 rb_raise(rb_eIndexError, "table column out of bounds");
185 }
186 }
187
188 // Enforce column numbers that are within bounds 0 <= column <= numColumns
189 %typemap(check) FXint TABLE_COLUMN_ALL {
190 if ($1 < 0 || $1 > arg1->getNumColumns()) {
191 rb_raise(rb_eIndexError, "table column out of bounds");
192 }
193 }
194
195 // Enforce column = 0 or column = 1 only
196 %typemap(check) FXint COLUMN_ZERO_OR_ONE {
197 if ($1 != 0 && $1 != 1) {
198 rb_raise(rb_eIndexError, "table column out of bounds");
199 }
200 }
201
202 // Special for removeColumns()
203 %typemap(check) (FXint col,FXint nc) {
204 if ($1 < 0 || $1 + $2 > arg1->getNumColumns()) {
205 rb_raise(rb_eIndexError,"table column out of bounds");
206 }
207 }
208
209 %apply FXint TABLE_ROW_INDEX { FXint row, FXint r, FXint startrow, FXint endrow };
210 %apply FXint TABLE_COLUMN_INDEX { FXint col, FXint c, FXint startcol, FXint endcol };
211
212 %rename("editable=") FXTable::setEditable(FXbool);
213 %rename("editable?") FXTable::isEditable() const;
214 %rename("cornerButton") FXTable::getCornerButton() const;
215 %rename("columnRenumbering=") FXTable::setColumnRenumbering(FXbool flag);
216 %rename("columnRenumbering?") FXTable::getColumnRenumbering() const;
217 %rename("rowRenumbering=") FXTable::setRowRenumbering(FXbool flag);
218 %rename("rowRenumbering?") FXTable::getRowRenumbering() const;
219
220 /// Table Widget
221 class FXTable : public FXScrollArea {
222 public:
223 static FXDragType csvType;
224 static const FXchar csvTypeName[];
225 public:
226 long onPaint(FXObject*,FXSelector,void* PTR_EVENT);
227 long onFocusIn(FXObject*,FXSelector,void* PTR_EVENT);
228 long onFocusOut(FXObject*,FXSelector,void* PTR_EVENT);
229 long onMotion(FXObject*,FXSelector,void* PTR_EVENT);
230 long onKeyPress(FXObject*,FXSelector,void* PTR_EVENT);
231 long onKeyRelease(FXObject*,FXSelector,void* PTR_EVENT);
232 long onLeftBtnPress(FXObject*,FXSelector,void* PTR_EVENT);
233 long onLeftBtnRelease(FXObject*,FXSelector,void* PTR_EVENT);
234 long onRightBtnPress(FXObject*,FXSelector,void* PTR_EVENT);
235 long onRightBtnRelease(FXObject*,FXSelector,void* PTR_EVENT);
236 long onUngrabbed(FXObject*,FXSelector,void* PTR_EVENT);
237 long onSelectionLost(FXObject*,FXSelector,void* PTR_EVENT);
238 long onSelectionGained(FXObject*,FXSelector,void* PTR_EVENT);
239 long onSelectionRequest(FXObject*,FXSelector,void* PTR_EVENT);
240 long onClipboardLost(FXObject*,FXSelector,void* PTR_EVENT);
241 long onClipboardGained(FXObject*,FXSelector,void* PTR_EVENT);
242 long onClipboardRequest(FXObject*,FXSelector,void* PTR_EVENT);
243 long onAutoScroll(FXObject*,FXSelector,void* PTR_EVENT);
244 long onCommand(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
245 long onClicked(FXObject*,FXSelector,void* PTR_EVENT);
246 long onDoubleClicked(FXObject*,FXSelector,void* PTR_EVENT);
247 long onTripleClicked(FXObject*,FXSelector,void* PTR_EVENT);
bea4cad @larskanis Strip all whitespaces on line endings
authored
248
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
249 long onCmdToggleEditable(FXObject*,FXSelector,void* PTR_IGNORE);
250 long onUpdToggleEditable(FXObject*,FXSelector,void* PTR_IGNORE);
251
252 // Visual characteristics
253 long onCmdHorzGrid(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
254 long onUpdHorzGrid(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
255 long onCmdVertGrid(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
256 long onUpdVertGrid(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
bea4cad @larskanis Strip all whitespaces on line endings
authored
257
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
258 // Row/Column manipulations
259 long onCmdDeleteColumn(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
260 long onUpdDeleteColumn(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
261 long onCmdDeleteRow(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
262 long onUpdDeleteRow(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
263 long onCmdInsertColumn(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
264 long onUpdInsertColumn(FXObject*,FXSelector,void* PTR_IGNORE);
265 long onCmdInsertRow(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
266 long onUpdInsertRow(FXObject*,FXSelector,void* PTR_IGNORE);
bea4cad @larskanis Strip all whitespaces on line endings
authored
267
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
268 // Movement
269 long onCmdMoveRight(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
270 long onCmdMoveLeft(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
271 long onCmdMoveUp(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
272 long onCmdMoveDown(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
273 long onCmdMoveHome(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
274 long onCmdMoveEnd(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
275 long onCmdMoveTop(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
276 long onCmdMoveBottom(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
277 long onCmdMovePageDown(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
278 long onCmdMovePageUp(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
279
280 // Mark and extend
281 long onCmdMark(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
282 long onCmdExtend(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
283
284 // Changing Selection
285 long onUpdSelectCell(FXObject*,FXSelector,void*); // FIXME
286 long onCmdSelectCell(FXObject*,FXSelector,void* PTR_IGNORE);
287 long onUpdSelectRow(FXObject*,FXSelector,void*); // FIXME
288 long onCmdSelectRow(FXObject*,FXSelector,void* PTR_IGNORE);
289 long onUpdSelectColumn(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
290 long onCmdSelectColumn(FXObject*,FXSelector,void* PTR_IGNORE);
291 long onCmdSelectRowIndex(FXObject*,FXSelector,void* PTR_IGNORE);
292 long onCmdSelectColumnIndex(FXObject*,FXSelector,void* PTR_IGNORE);
293 long onUpdSelectAll(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
294 long onCmdSelectAll(FXObject*,FXSelector,void* PTR_IGNORE);
295 long onUpdDeselectAll(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
296 long onCmdDeselectAll(FXObject*,FXSelector,void* PTR_IGNORE);
297
298 // Manipulation Selection
299 long onCmdCutSel(FXObject*,FXSelector,void* PTR_IGNORE);
300 long onCmdCopySel(FXObject*,FXSelector,void* PTR_IGNORE);
301 long onCmdDeleteSel(FXObject*,FXSelector,void* PTR_IGNORE);
302 long onCmdPasteSel(FXObject*,FXSelector,void* PTR_IGNORE);
303 long onUpdHaveSelection(FXObject*,FXSelector,void* PTR_IGNORE);
304
305 // Edit control
306 long onCmdStartInput(FXObject*,FXSelector,void* PTR_IGNORE);
307 long onUpdStartInput(FXObject*,FXSelector,void* PTR_IGNORE);
308 long onCmdAcceptInput(FXObject*,FXSelector,void* PTR_IGNORE);
309 long onUpdAcceptInput(FXObject*,FXSelector,void* PTR_IGNORE);
310 long onCmdCancelInput(FXObject*,FXSelector,void* PTR_IGNORE);
311
312 public:
313
314 enum {
315 ID_HORZ_GRID=FXScrollArea::ID_LAST,
316 ID_VERT_GRID,
317 ID_TOGGLE_EDITABLE,
318 ID_DELETE_COLUMN,
319 ID_DELETE_ROW,
320 ID_INSERT_COLUMN,
321 ID_INSERT_ROW,
322 ID_SELECT_COLUMN_INDEX,
323 ID_SELECT_ROW_INDEX,
324 ID_SELECT_COLUMN,
325 ID_SELECT_ROW,
326 ID_SELECT_CELL,
327 ID_SELECT_ALL,
328 ID_DESELECT_ALL,
329 ID_MOVE_LEFT,
330 ID_MOVE_RIGHT,
331 ID_MOVE_UP,
332 ID_MOVE_DOWN,
333 ID_MOVE_HOME,
334 ID_MOVE_END,
335 ID_MOVE_TOP,
336 ID_MOVE_BOTTOM,
337 ID_MOVE_PAGEDOWN,
338 ID_MOVE_PAGEUP,
339 ID_START_INPUT,
340 ID_CANCEL_INPUT,
341 ID_ACCEPT_INPUT,
342 ID_MARK,
343 ID_EXTEND,
344 ID_CUT_SEL,
345 ID_COPY_SEL,
346 ID_PASTE_SEL,
347 ID_DELETE_SEL,
348 ID_LAST
349 };
350
351 public:
bea4cad @larskanis Strip all whitespaces on line endings
authored
352
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
353 /**
354 * Construct a new table.
355 * The table is initially empty, and reports a default size based on
356 * the scroll areas's scrollbar placement policy.
357 */
358 %extend {
359 FXTable(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_MARGIN,FXint pr=DEFAULT_MARGIN,FXint pt=DEFAULT_MARGIN,FXint pb=DEFAULT_MARGIN){
360 return new FXRbTable(p,tgt,sel,opts,x,y,w,h,pl,pr,pt,pb);
361 }
362 }
bea4cad @larskanis Strip all whitespaces on line endings
authored
363
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
364 /// Return button in the top/left corner
365 FXButton* getCornerButton() const;
366
367 /// Return column header control
368 FXHeader* getColumnHeader() const;
369
370 /// Return row header control
371 FXHeader* getRowHeader() const;
372
373 /// Change number of visible rows
374 void setVisibleRows(FXint nvrows);
bea4cad @larskanis Strip all whitespaces on line endings
authored
375
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
376 /// Return number of visible rows
377 FXint getVisibleRows() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
378
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
379 // Change number of visible columns
380 void setVisibleColumns(FXint nvcols);
bea4cad @larskanis Strip all whitespaces on line endings
authored
381
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
382 // Return number of visible columns
383 FXint getVisibleColumns() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
384
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
385 /// Return TRUE if table is editable
386 FXbool isEditable() const;
387
388 /// Set editable flag
389 void setEditable(FXbool edit=TRUE);
390
391 /// Show or hide horizontal grid
392 void showHorzGrid(FXbool on=TRUE);
393
394 /// Is horizontal grid shown
395 FXbool isHorzGridShown() const;
396
397 /// Show or hide vertical grid
398 void showVertGrid(FXbool on=TRUE);
bea4cad @larskanis Strip all whitespaces on line endings
authored
399
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
400 /// Is vertical grid shown
401 FXbool isVertGridShown() const;
402
403 /// Get number of rows
404 FXint getNumRows() const;
405
406 /// Get number of columns
407 FXint getNumColumns() const;
408
409 /// Change top cell margin
410 void setMarginTop(FXint pt);
411
412 /// Return top cell margin
413 FXint getMarginTop() const;
414
415 /// Change bottom cell margin
416 void setMarginBottom(FXint pb);
417
418 /// Return bottom cell margin
419 FXint getMarginBottom() const;
420
421 /// Change left cell margin
422 void setMarginLeft(FXint pl);
423
424 /// Return left cell margin
425 FXint getMarginLeft() const;
426
427 /// Change right cell margin
428 void setMarginRight(FXint pr);
429
430 /// Return right cell margin
431 FXint getMarginRight() const;
432
433 /**
434 * Determine column containing x.
435 * Returns -1 if x left of first column, and ncols if x right of last column;
436 * otherwise, returns column in table containing x.
437 */
438 FXint colAtX(FXint x) const;
439
440 /**
441 * Determine row containing y.
442 * Returns -1 if y above first row, and nrows if y below last row;
443 * otherwise, returns row in table containing y.
444 */
445 FXint rowAtY(FXint y) const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
446
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
447 /// Return the item at the given index
448 FXTableItem *getItem(FXint row,FXint col) const;
449
450 %extend {
451 /// Replace the item with a [possibly subclassed] item
452 void setItem(FXint row,FXint col,FXTableItem* item,FXbool notify=FALSE){
453 if(item!=0 && item->isMemberOf(FXMETACLASS(FXRbTableItem))){
454 dynamic_cast<FXRbTableItem*>(item)->owned=TRUE;
455 }
456 self->setItem(row,col,item,notify);
457 }
458 }
459
460 // Return TRUE if item partially visible
461 FXbool isItemVisible(FXint r,FXint c) const;
462
463 /**
464 * Change column header height mode to fixed or variable.
465 * In variable height mode, the column header will size to
466 * fit the contents in it. In fixed mode, the size is
467 * explicitly set using setColumnHeaderHeight().
468 */
469 void setColumnHeaderMode(FXuint hint=LAYOUT_FIX_HEIGHT);
470
471 /// Return column header height mode
472 FXuint getColumnHeaderMode() const;
473
474 /**
475 * Change row header width mode to fixed or variable.
476 * In variable width mode, the row header will size to
477 * fit the contents in it. In fixed mode, the size is
478 * explicitly set using setRowHeaderWidth().
479 */
480 void setRowHeaderMode(FXuint hint=LAYOUT_FIX_WIDTH);
481
482 /// Return row header width mode
483 FXuint getRowHeaderMode() const;
484
485 /// Set column header font
486 void setColumnHeaderFont(FXFont* fnt);
487
488 /// Return column header font
489 FXFont* getColumnHeaderFont() const;
490
491 /// Set row header font
492 void setRowHeaderFont(FXFont* fnt);
493
494 /// Return row header font
495 FXFont* getRowHeaderFont() const;
496
497 /// Change column header height
498 void setColumnHeaderHeight(FXint h);
499
500 /// Return column header height
501 FXint getColumnHeaderHeight() const;
502
503 /// Change row header width
504 void setRowHeaderWidth(FXint w);
505
506 /// Return row header width
507 FXint getRowHeaderWidth() const;
508
509 %extend {
510 FXint getColumnX(FXint colEdge) const {
511 if(colEdge<0 || self->getColumnHeader()->getNumItems()<=colEdge){
512 rb_raise(rb_eIndexError,"table column out of bounds");
513 }
514 return self->getColumnX(colEdge);
515 }
bea4cad @larskanis Strip all whitespaces on line endings
authored
516
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
517 /// Change Y coordinate of row r
518 FXint getRowY(FXint rowEdge) const {
519 if(rowEdge<0 || self->getRowHeader()->getNumItems()<=rowEdge){
520 rb_raise(rb_eIndexError,"table row out of bounds");
521 }
522 return self->getRowY(rowEdge);
523 }
524 }
bea4cad @larskanis Strip all whitespaces on line endings
authored
525
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
526 /// Get column width
527 FXint getColumnWidth(FXint col) const;
528
529 /// Get row height
530 FXint getRowHeight(FXint row) const;
531
532 /// Change default column width
533 void setDefColumnWidth(FXint cwidth);
bea4cad @larskanis Strip all whitespaces on line endings
authored
534
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
535 /// Get default column width
536 FXint getDefColumnWidth() const;
537
538 /// Change default row height
539 void setDefRowHeight(FXint rheight);
bea4cad @larskanis Strip all whitespaces on line endings
authored
540
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
541 /// Get default row height
542 FXint getDefRowHeight() const;
543
544 /// Return minimum row height
545 FXint getMinRowHeight(FXint r) const;
546
547 /// Return minimum column width
548 FXint getMinColumnWidth(FXint c) const;
549
550 /// Fit row heights to contents
551 void fitRowsToContents(FXint row,FXint nr=1);
552
553 /// Fit column widths to contents
554 void fitColumnsToContents(FXint col,FXint nc=1);
555
556 /// Change column header
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
557 void setColumnText(FXint TABLE_COLUMN_INDEX,const FXString& text);
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
558
559 /// Return text of column header at index
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
560 FXString getColumnText(FXint TABLE_COLUMN_INDEX) const;
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
561
562 /// Change row header
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
563 void setRowText(FXint TABLE_ROW_INDEX,const FXString& text);
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
564
565 /// Return text of row header at index
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
566 FXString getRowText(FXint TABLE_ROW_INDEX) const;
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
567
568 /// Change column header icon
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
569 void setColumnIcon(FXint TABLE_COLUMN_INDEX,FXIcon* icon);
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
570
571 /// Return icon of column header at index
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
572 FXIcon* getColumnIcon(FXint TABLE_COLUMN_INDEX) const;
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
573
574 /// Change row header icon
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
575 void setRowIcon(FXint TABLE_ROW_INDEX,FXIcon* icon);
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
576
577 /// Return icon of row header at index
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
578 FXIcon* getRowIcon(FXint TABLE_ROW_INDEX) const;
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
579
580 /// Change column header icon position, e.g. FXHeaderItem::BEFORE, etc.
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
581 void setColumnIconPosition(FXint TABLE_COLUMN_INDEX,FXuint mode);
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
582
583 /// Return icon position of column header at index
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
584 FXuint getColumnIconPosition(FXint TABLE_COLUMN_INDEX) const;
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
585
586 /// Change row header icon position, e.g. FXHeaderItem::BEFORE, etc.
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
587 void setRowIconPosition(FXint TABLE_ROW_INDEX,FXuint mode);
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
588
589 /// Return icon position of row header at index
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
590 FXuint getRowIconPosition(FXint TABLE_ROW_INDEX) const;
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
591
592 /// Change column header justify, e.g. FXHeaderItem::RIGHT, etc.
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
593 void setColumnJustify(FXint TABLE_COLUMN_INDEX,FXuint justify);
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
594
595 /// Return justify of column header at index
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
596 FXuint getColumnJustify(FXint TABLE_COLUMN_INDEX) const;
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
597
598 /// Change row header justify, e.g. FXHeaderItem::RIGHT, etc.
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
599 void setRowJustify(FXint TABLE_ROW_INDEX,FXuint justify);
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
600
601 /// Return justify of row header at index
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
602 FXuint getRowJustify(FXint TABLE_ROW_INDEX) const;
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
603
604 %extend {
605 /// Modify cell text
606 void setItemText(FXint r,FXint c,const FXString& text,FXbool notify=FALSE){
607 FXRbTableItem* item;
608 self->setItemText(r,c,text,notify);
609 item=dynamic_cast<FXRbTableItem*>(self->getItem(r,c));
610 if(item!=0){
611 item->owned=TRUE;
612 }
613 }
614 }
bea4cad @larskanis Strip all whitespaces on line endings
authored
615
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
616 // Get cell text
617 FXString getItemText(FXint r,FXint c) const;
618
bea4cad @larskanis Strip all whitespaces on line endings
authored
619 %extend {
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
620 /// Modify cell icon, deleting the old icon if it was owned
621 void setItemIcon(FXint r,FXint c,FXIcon* icon,FXbool notify=FALSE){
622 FXRbTableItem* item;
623 self->setItemIcon(r,c,icon,notify);
624 item=dynamic_cast<FXRbTableItem*>(self->getItem(r,c));
625 if(item!=0){
626 item->owned=TRUE;
627 }
628 }
629 }
bea4cad @larskanis Strip all whitespaces on line endings
authored
630
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
631 // Get the item's icon
632 FXIcon* getItemIcon(FXint r,FXint c) const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
633
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
634 %extend {
635 /// Modify cell user-data
636 void setItemData(FXint r,FXint c,VALUE ptr){
637 FXRbTableItem* item;
638 self->setItemData(r,c,reinterpret_cast<void*>(ptr));
639 item=dynamic_cast<FXRbTableItem*>(self->getItem(r,c));
640 if(item!=0){
641 item->owned=TRUE;
642 }
643 }
644
645 /// Get cell user data
646 VALUE getItemData(FXint r,FXint c) const {
647 void* ptr=self->getItemData(r,c);
648 return (ptr!=0) ? reinterpret_cast<VALUE>(ptr) : Qnil;
649 }
650 }
bea4cad @larskanis Strip all whitespaces on line endings
authored
651
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
652 %extend {
653 /// Extract cells from given range as text.
654 VALUE extractText(FXint startrow,FXint endrow,FXint startcol,FXint endcol,const FXchar* cs="\t",const FXchar* rs="\n") const {
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
655 FXString str;
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
656 VALUE result;
657 if(startrow<0 || startcol<0 || self->getNumRows()<=endrow || self->getNumColumns()<=endcol) rb_raise(rb_eIndexError,"index out of bounds");
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
658 self->extractText(str,startrow,endrow,startcol,endcol,cs,rs);
659 result=rb_str_new2(str.text());
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
660 return result;
661 }
662
663 /// Overlay text over given cell range
664 void overlayText(FXint startrow,FXint endrow,FXint startcol,FXint endcol,VALUE str,const FXchar* cs="\t",const FXchar* rs="\n",FXbool notify=FALSE){
665 if(startrow<0 || startcol<0 || self->getNumRows()<=endrow || self->getNumColumns()<=endcol) rb_raise(rb_eIndexError,"index out of bounds");
b6b1acb @lylejohnson checked in changes from the RB-1.6 branch (through r2945)
lylejohnson authored
666 const FXchar* text=reinterpret_cast<FXchar*>(StringValuePtr(str));
667 FXint size=RSTRING_LEN(str);
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
668 self->overlayText(startrow,endrow,startcol,endcol,text,size,cs,rs,notify);
669 }
670 }
671
672 %extend {
673 /**
674 * Determine the number of rows and columns in a block of text
675 * where columns are separated by characters from the set cs, and rows
676 * are separated by characters from the set rs.
677 */
678 VALUE countText(const FXString& text,const FXchar* cs="\t,",const FXchar* rs="\n") const {
679 FXint nr,nc;
680 self->countText(nr,nc,text,cs,rs);
681 return rb_ary_new3(2,INT2NUM(nr),INT2NUM(nc));
682 }
683 }
684
685 /// Return TRUE if its a spanning cell
686 FXbool isItemSpanning(FXint r,FXint c) const;
687
688 %extend {
689 /// Repaint cells between grid lines sr,er and grid lines sc,ec
690 void updateRange(FXint sr,FXint er,FXint sc,FXint ec) const {
691 if(sr<0 || sc<0 || self->getNumRows()<=er || self->getNumColumns()<=ec) rb_raise(rb_eIndexError,"index out of bounds");
692 self->updateRange(sr,er,sc,ec);
693 }
694 }
695
696 /// Repaint cell at r,c
697 void updateItem(FXint r,FXint c) const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
698
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
699 // Is item enabled?
700 FXbool isItemEnabled(FXint r,FXint c) const;
701
702 /**
703 * Change item justification. Horizontal justification is controlled by passing
704 * FXTableItem::RIGHT, FXTableItem::LEFT, or FXTableItem::CENTER_X.
705 * Vertical justification is controlled by FXTableItem::TOP, FXTableItem::BOTTOM,
706 * or FXTableItem::CENTER_Y.
707 * The default is a combination of FXTableItem::RIGHT and FXTableItem::CENTER_Y.
708 */
709 void setItemJustify(FXint r,FXint c,FXuint justify);
bea4cad @larskanis Strip all whitespaces on line endings
authored
710
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
711 /// Return item justification
712 FXuint getItemJustify(FXint r,FXint c) const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
713
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
714 /**
715 * Change relative position of icon and text of item.
716 * Passing FXTableItem::BEFORE or FXTableItem::AFTER places the icon
717 * before or after the text, and passing FXTableItem::ABOVE or
718 * FXTableItem::BELOW places it above or below the text, respectively.
719 * The default is 0 which places the text on top of the icon.
720 */
721 void setItemIconPosition(FXint r,FXint c,FXuint mode);
bea4cad @larskanis Strip all whitespaces on line endings
authored
722
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
723 /// Return relative icon and text position
724 FXuint getItemIconPosition(FXint r,FXint c) const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
725
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
726 /**
727 * Change item borders style. Borders on each side of the item can be turned
728 * controlled individually using FXTableItem::LBORDER, FXTableItem::RBORDER,
729 * FXTableItem::TBORDER and FXTableItem::BBORDER.
730 */
731 void setItemBorders(FXint r,FXint c,FXuint borders);
bea4cad @larskanis Strip all whitespaces on line endings
authored
732
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
733 /// Return item border style
734 FXuint getItemBorders(FXint r,FXint c) const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
735
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
736 /// Change item background stipple style
737 void setItemStipple(FXint r,FXint c,FXStipplePattern pat);
bea4cad @larskanis Strip all whitespaces on line endings
authored
738
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
739 /// Return item background stipple style
740 FXStipplePattern getItemStipple(FXint r,FXint c) const;
741
742 /// Get row number of current item
743 FXint getCurrentRow() const;
744
745 /// Get column number of current item
746 FXint getCurrentColumn() const;
747
748 /// Is this the current item?
749 FXbool isItemCurrent(FXint r,FXint c) const;
750
751 /// Change anchor item
752 void setAnchorItem(FXint r,FXint c);
753
754 /// Get row number of anchor item
755 FXint getAnchorRow() const;
756
757 /// Get column number of anchor item
758 FXint getAnchorColumn() const;
759
760 /// Get selection start row; returns -1 if no selection
761 FXint getSelStartRow() const;
762
763 /// Get selection start column; returns -1 if no selection
764 FXint getSelStartColumn() const;
765
766 /// Get selection end row; returns -1 if no selection
767 FXint getSelEndRow() const;
768
769 /// Get selection end column; returns -1 if no selection
770 FXint getSelEndColumn() const;
771
772 /// Is item selected?
773 FXbool isItemSelected(FXint r,FXint c) const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
774
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
775 /// Is row of cells selected
776 FXbool isRowSelected(FXint r) const;
777
778 /// Is column selected
779 FXbool isColumnSelected(FXint c) const;
780
781 /// Is anything selected
782 FXbool isAnythingSelected() const;
783
784 /// Change font
785 void setFont(FXFont* fnt);
786 FXFont* getFont() const;
787
788 /// Obtain colors of various parts
789 FXColor getTextColor() const;
790 FXColor getBaseColor() const;
791 FXColor getHiliteColor() const;
792 FXColor getShadowColor() const;
793 FXColor getBorderColor() const;
794 FXColor getSelBackColor() const;
795 FXColor getSelTextColor() const;
796 FXColor getGridColor() const;
797 FXColor getStippleColor() const;
798 FXColor getCellBorderColor() const;
799
800 /// Change colors of various parts
801 void setTextColor(FXColor clr);
802 void setBaseColor(FXColor clr);
803 void setHiliteColor(FXColor clr);
804 void setShadowColor(FXColor clr);
805 void setBorderColor(FXColor clr);
806 void setSelBackColor(FXColor clr);
807 void setSelTextColor(FXColor clr);
808 void setGridColor(FXColor clr);
809 void setStippleColor(FXColor clr);
810 void setCellBorderColor(FXColor clr);
811
812 /// Change cell background color for even/odd rows/columns
813 void setCellColor(FXint ROW_ZERO_OR_ONE,FXint COLUMN_ZERO_OR_ONE,FXColor clr);
814
815 /// Obtain cell background color for even/odd rows/columns
816 FXColor getCellColor(FXint ROW_ZERO_OR_ONE,FXint COLUMN_ZERO_OR_ONE) const;
817
818 /// Change cell border width
819 void setCellBorderWidth(FXint borderwidth);
820
821 /// Return cell border width
822 FXint getCellBorderWidth() const;
823
824 /// Change table style
825 FXuint getTableStyle() const;
826 void setTableStyle(FXuint style);
bea4cad @larskanis Strip all whitespaces on line endings
authored
827
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
828 /// Set column renumbering
829 void setColumnRenumbering(FXbool flag);
830
831 /// Get column renumbering
832 FXbool getColumnRenumbering() const;
833
834 /// Set row renumbering
835 void setRowRenumbering(FXbool flag);
836
837 /// Get row renumbering
838 FXbool getRowRenumbering() const;
839
840 /// Change help text
841 void setHelpText(const FXString& text);
bea4cad @larskanis Strip all whitespaces on line endings
authored
842
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
843 /// Get help text
844 const FXString& getHelpText() const;
845
846 /// Destructor
847 virtual ~FXTable();
848 };
849
850 %clear FXint r;
851 %clear FXint row;
852 %clear FXint c;
853 %clear FXint col;
854
855 DECLARE_FXOBJECT_VIRTUALS(FXTable)
856 DECLARE_FXID_VIRTUALS(FXTable)
857 DECLARE_FXDRAWABLE_VIRTUALS(FXTable)
858 DECLARE_FXWINDOW_VIRTUALS(FXTable)
859 DECLARE_FXSCROLLAREA_VIRTUALS(FXTable)
860 DECLARE_FXTABLE_VIRTUALS(FXTable)
861
Something went wrong with that request. Please try again.