Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXTable.h
1 /********************************************************************************
2 * *
3 * T a b l e W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1999,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXTABLE_H
22 #define FXTABLE_H
23 
24 #ifndef FXSCROLLAREA_H
25 #include "FXScrollArea.h"
26 #endif
27 
28 namespace FX {
29 
30 class FXIcon;
31 class FXFont;
32 class FXTable;
33 class FXHeader;
34 class FXButton;
35 
36 
38 enum { DEFAULT_MARGIN = 2 };
39 
40 
42 enum {
43  TABLE_COL_SIZABLE = 0x00100000,
44  TABLE_ROW_SIZABLE = 0x00200000,
45  TABLE_NO_COLSELECT = 0x00400000,
46  TABLE_NO_ROWSELECT = 0x00800000,
47  TABLE_READONLY = 0x01000000
48  };
49 
50 
52 struct FXTablePos {
53  FXint row;
54  FXint col;
55  };
56 
57 
59 struct FXTableRange {
60  FXTablePos fm;
61  FXTablePos to;
62  };
63 
64 
66 class FXAPI FXTableItem : public FXObject {
67  FXDECLARE(FXTableItem)
68  friend class FXTable;
69 protected:
70  FXString label;
71  FXString tip;
72  FXIcon *icon;
73  FXptr data;
74  FXuint state;
75 private:
76  FXTableItem(const FXTableItem&);
77  FXTableItem& operator=(const FXTableItem&);
78 protected:
79  FXTableItem():icon(nullptr),data(nullptr),state(0){}
80  FXint textWidth(const FXTable* table) const;
81  FXint textHeight(const FXTable* table) const;
82  virtual void draw(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
83  virtual void drawBorders(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
84  virtual void drawContent(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
85  virtual void drawPattern(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
86  virtual void drawBackground(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
87 public:
88  enum{
89  SELECTED = 0x00000001,
90  FOCUS = 0x00000002,
91  DISABLED = 0x00000004,
92  DRAGGABLE = 0x00000008,
93  RESERVED1 = 0x00000010,
94  RESERVED2 = 0x00000020,
95  ICONOWNED = 0x00000040,
96  RIGHT = 0x00002000,
97  LEFT = 0x00004000,
98  CENTER_X = 0,
99  TOP = 0x00008000,
100  BOTTOM = 0x00010000,
101  CENTER_Y = 0,
102  BEFORE = 0x00020000,
103  AFTER = 0x00040000,
104  ABOVE = 0x00080000,
105  BELOW = 0x00100000,
106  LBORDER = 0x00200000,
107  RBORDER = 0x00400000,
108  TBORDER = 0x00800000,
109  BBORDER = 0x01000000
110  };
111 public:
112 
114  FXTableItem(const FXString& text,FXIcon* ic=nullptr,FXptr ptr=nullptr):label(text),icon(ic),data(ptr),state(RIGHT|CENTER_Y){}
115 
117  virtual void setText(const FXString& txt);
118 
120  virtual FXString getText() const { return label; }
121 
123  virtual void setIcon(FXIcon* icn,FXbool owned=false);
124 
126  virtual FXIcon* getIcon() const { return icon; }
127 
129  void setTipText(const FXString& text){ tip=text; }
130 
132  const FXString& getTipText() const { return tip; }
133 
135  void setData(FXptr ptr){ data=ptr; }
136 
138  FXptr getData() const { return data; }
139 
141  virtual void setFocus(FXbool focus);
142 
144  FXbool hasFocus() const { return (state&FOCUS)!=0; }
145 
147  virtual void setSelected(FXbool selected);
148 
150  FXbool isSelected() const { return (state&SELECTED)!=0; }
151 
153  virtual void setEnabled(FXbool enabled);
154 
156  FXbool isEnabled() const { return (state&DISABLED)==0; }
157 
159  virtual void setDraggable(FXbool draggable);
160 
162  FXbool isDraggable() const { return (state&DRAGGABLE)!=0; }
163 
165  virtual void setJustify(FXuint justify=RIGHT|CENTER_Y);
166 
168  FXuint getJustify() const { return state&(RIGHT|LEFT|TOP|BOTTOM); }
169 
171  virtual void setIconPosition(FXuint mode);
172 
174  FXuint getIconPosition() const { return state&(BEFORE|AFTER|ABOVE|BELOW); }
175 
177  virtual void setBorders(FXuint borders=0);
178 
180  FXuint getBorders() const { return state&(LBORDER|RBORDER|TBORDER|BBORDER); }
181 
183  virtual void setStipple(FXStipplePattern pattern);
184 
186  FXStipplePattern getStipple() const;
187 
189  virtual FXWindow* getControlFor(FXTable* table);
190 
192  virtual void setFromControl(FXWindow* control);
193 
195  virtual FXint getWidth(const FXTable* table) const;
196 
198  virtual FXint getHeight(const FXTable* table) const;
199 
201  virtual void create();
202 
204  virtual void detach();
205 
207  virtual void destroy();
208 
210  virtual void save(FXStream& store) const;
211 
213  virtual void load(FXStream& store);
214 
216  virtual ~FXTableItem();
217  };
218 
219 
221 class FXAPI FXComboTableItem : public FXTableItem {
222  FXDECLARE(FXComboTableItem)
223 protected:
224  FXString selections;
225 private:
227  FXComboTableItem& operator=(const FXComboTableItem&);
228 protected:
229  FXComboTableItem(){}
230 public:
231 
233  FXComboTableItem(const FXString& text,FXIcon* ic=nullptr,void* ptr=nullptr);
234 
236  virtual FXWindow *getControlFor(FXTable* table);
237 
239  virtual void setFromControl(FXWindow *control);
240 
242  void setSelections(const FXString& strings);
243 
245  const FXString& getSelections() const { return selections; }
246  };
247 
248 
288 class FXAPI FXTable : public FXScrollArea {
289  FXDECLARE(FXTable)
290 protected:
291  FXHeader *colHeader; // Column header
292  FXHeader *rowHeader; // Row header
293  FXButton *cornerButton; // Corner button
294  FXTableItem **cells; // Cells
295  FXWindow *editor; // Editor widget
296  FXFont *font; // Font
297  FXint nrows; // Number of rows
298  FXint ncols; // Number of columns
299  FXint visiblerows; // Visible rows
300  FXint visiblecols; // Visible columns
301  FXint margintop; // Margin top
302  FXint marginbottom; // Margin bottom
303  FXint marginleft; // Margin left
304  FXint marginright; // Margin right
305  FXColor textColor; // Normal text color
306  FXColor baseColor; // Base color
307  FXColor hiliteColor; // Highlight color
308  FXColor shadowColor; // Shadow color
309  FXColor borderColor; // Border color
310  FXColor selbackColor; // Select background color
311  FXColor seltextColor; // Select text color
312  FXColor gridColor; // Grid line color
313  FXColor stippleColor; // Stipple color
314  FXColor cellBorderColor; // Cell border color
315  FXint cellBorderWidth; // Cell border width
316  FXColor cellBackColor[2][2]; // Row/Column even/odd background color
317  FXint defColWidth; // Default column width [if uniform columns]
318  FXint defRowHeight; // Default row height [if uniform rows]
319  FXTablePos current; // Current position
320  FXTablePos anchor; // Anchor position
321  FXTableRange input; // Input cell
322  FXTableRange selection; // Range of selected cells
323  FXString clipped; // Clipped text
324  FXbool hgrid; // Horizontal grid lines shown
325  FXbool vgrid; // Vertical grid lines shown
326  FXuchar mode; // Mode widget is in
327  FXint grabx; // Grab point x
328  FXint graby; // Grab point y
329  FXint rowcol; // Row or column being resized
330  FXString help;
331 public:
332  static FXDragType csvType;
333  static const FXchar csvTypeName[];
334 protected:
335  FXTable();
336  virtual void moveContents(FXint x,FXint y);
337  virtual void drawCell(FXDC& dc,FXint sr,FXint er,FXint sc,FXint ec);
338  virtual void drawRange(FXDC& dc,FXint rlo,FXint rhi,FXint clo,FXint chi);
339  virtual void drawHGrid(FXDC& dc,FXint rlo,FXint rhi,FXint clo,FXint chi);
340  virtual void drawVGrid(FXDC& dc,FXint rlo,FXint rhi,FXint clo,FXint chi);
341  virtual void drawContents(FXDC& dc,FXint x,FXint y,FXint w,FXint h);
342  virtual FXTableItem* createItem(const FXString& text,FXIcon* icon,void* ptr);
343  virtual FXWindow* getControlForItem(FXint r,FXint c);
344  virtual void setItemFromControl(FXint r,FXint c,FXWindow* control);
345 protected:
346  enum {
347  MOUSE_NONE, // Nop
348  MOUSE_SCROLL, // Scrolling
349  MOUSE_DRAG, // Dragging
350  MOUSE_SELECT // Selecting
351  };
352 private:
353  FXTable(const FXTable&);
354  FXTable& operator=(const FXTable&);
355 public:
356  long onPaint(FXObject*,FXSelector,void*);
357  long onEnter(FXObject*,FXSelector,void*);
358  long onLeave(FXObject*,FXSelector,void*);
359  long onFocusIn(FXObject*,FXSelector,void*);
360  long onFocusOut(FXObject*,FXSelector,void*);
361  long onMotion(FXObject*,FXSelector,void*);
362  long onKeyPress(FXObject*,FXSelector,void*);
363  long onKeyRelease(FXObject*,FXSelector,void*);
364  long onLeftBtnPress(FXObject*,FXSelector,void*);
365  long onLeftBtnRelease(FXObject*,FXSelector,void*);
366  long onRightBtnPress(FXObject*,FXSelector,void*);
367  long onRightBtnRelease(FXObject*,FXSelector,void*);
368  long onUngrabbed(FXObject*,FXSelector,void*);
369  long onSelectionLost(FXObject*,FXSelector,void*);
370  long onSelectionGained(FXObject*,FXSelector,void*);
371  long onSelectionRequest(FXObject*,FXSelector,void* ptr);
372  long onClipboardLost(FXObject*,FXSelector,void*);
373  long onClipboardGained(FXObject*,FXSelector,void*);
374  long onClipboardRequest(FXObject*,FXSelector,void*);
375  long onAutoScroll(FXObject*,FXSelector,void*);
376  long onCommand(FXObject*,FXSelector,void*);
377  long onClicked(FXObject*,FXSelector,void*);
378  long onDoubleClicked(FXObject*,FXSelector,void*);
379  long onTripleClicked(FXObject*,FXSelector,void*);
380  long onQueryTip(FXObject*,FXSelector,void*);
381  long onQueryHelp(FXObject*,FXSelector,void*);
382  long onTipTimer(FXObject*,FXSelector,void*);
383 
384  long onCmdToggleEditable(FXObject*,FXSelector,void*);
385  long onUpdToggleEditable(FXObject*,FXSelector,void*);
386 
387  // Visual characteristics
388  long onCmdHorzGrid(FXObject*,FXSelector,void*);
389  long onUpdHorzGrid(FXObject*,FXSelector,void*);
390  long onCmdVertGrid(FXObject*,FXSelector,void*);
391  long onUpdVertGrid(FXObject*,FXSelector,void*);
392 
393  // Row/Column manipulations
394  long onCmdDeleteColumn(FXObject*,FXSelector,void*);
395  long onUpdDeleteColumn(FXObject*,FXSelector,void*);
396  long onCmdDeleteRow(FXObject*,FXSelector,void*);
397  long onUpdDeleteRow(FXObject*,FXSelector,void*);
398  long onCmdInsertColumn(FXObject*,FXSelector,void*);
399  long onUpdInsertColumn(FXObject*,FXSelector,void*);
400  long onCmdInsertRow(FXObject*,FXSelector,void*);
401  long onUpdInsertRow(FXObject*,FXSelector,void*);
402 
403  // Movement
404  long onCmdMoveRight(FXObject*,FXSelector,void*);
405  long onCmdMoveLeft(FXObject*,FXSelector,void*);
406  long onCmdMoveUp(FXObject*,FXSelector,void*);
407  long onCmdMoveDown(FXObject*,FXSelector,void*);
408  long onCmdMoveHome(FXObject*,FXSelector,void*);
409  long onCmdMoveEnd(FXObject*,FXSelector,void*);
410  long onCmdMoveTop(FXObject*,FXSelector,void*);
411  long onCmdMoveBottom(FXObject*,FXSelector,void*);
412  long onCmdMovePageDown(FXObject*,FXSelector,void*);
413  long onCmdMovePageUp(FXObject*,FXSelector,void*);
414 
415  // Mark and extend
416  long onCmdMark(FXObject*,FXSelector,void*);
417  long onCmdExtend(FXObject*,FXSelector,void*);
418 
419  // Changing Selection
420  long onUpdSelectCell(FXObject*,FXSelector,void*);
421  long onCmdSelectCell(FXObject*,FXSelector,void*);
422  long onUpdSelectRow(FXObject*,FXSelector,void*);
423  long onCmdSelectRow(FXObject*,FXSelector,void*);
424  long onUpdSelectColumn(FXObject*,FXSelector,void*);
425  long onCmdSelectColumn(FXObject*,FXSelector,void*);
426  long onCmdSelectRowIndex(FXObject*,FXSelector,void*);
427  long onCmdSelectColumnIndex(FXObject*,FXSelector,void*);
428  long onUpdSelectAll(FXObject*,FXSelector,void*);
429  long onCmdSelectAll(FXObject*,FXSelector,void*);
430  long onUpdDeselectAll(FXObject*,FXSelector,void*);
431  long onCmdDeselectAll(FXObject*,FXSelector,void*);
432 
433  // Manipulation Selection
434  long onCmdCutSel(FXObject*,FXSelector,void*);
435  long onCmdCopySel(FXObject*,FXSelector,void*);
436  long onCmdDeleteSel(FXObject*,FXSelector,void*);
437  long onCmdPasteSel(FXObject*,FXSelector,void*);
438  long onUpdHaveSelection(FXObject*,FXSelector,void*);
439 
440  // Edit control
441  long onCmdStartInput(FXObject*,FXSelector,void*);
442  long onUpdStartInput(FXObject*,FXSelector,void*);
443  long onCmdAcceptInput(FXObject*,FXSelector,void*);
444  long onUpdAcceptInput(FXObject*,FXSelector,void*);
445  long onCmdCancelInput(FXObject*,FXSelector,void*);
446 public:
447  enum {
448  ID_HORZ_GRID=FXScrollArea::ID_LAST,
449  ID_VERT_GRID,
450  ID_TOGGLE_EDITABLE,
451  ID_DELETE_COLUMN,
452  ID_DELETE_ROW,
453  ID_INSERT_COLUMN,
454  ID_INSERT_ROW,
455  ID_SELECT_COLUMN_INDEX,
456  ID_SELECT_ROW_INDEX,
457  ID_SELECT_COLUMN,
458  ID_SELECT_ROW,
459  ID_SELECT_CELL,
460  ID_SELECT_ALL,
461  ID_DESELECT_ALL,
462  ID_MOVE_LEFT,
463  ID_MOVE_RIGHT,
464  ID_MOVE_UP,
465  ID_MOVE_DOWN,
466  ID_MOVE_HOME,
467  ID_MOVE_END,
468  ID_MOVE_TOP,
469  ID_MOVE_BOTTOM,
470  ID_MOVE_PAGEDOWN,
471  ID_MOVE_PAGEUP,
472  ID_START_INPUT,
473  ID_CANCEL_INPUT,
474  ID_ACCEPT_INPUT,
475  ID_MARK,
476  ID_EXTEND,
477  ID_CUT_SEL,
478  ID_COPY_SEL,
479  ID_PASTE_SEL,
480  ID_DELETE_SEL,
481  ID_LAST
482  };
483 public:
484 
490  FXTable(FXComposite *p,FXObject* tgt=nullptr,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);
491 
493  virtual void create();
494 
496  virtual void detach();
497 
499  virtual FXint getContentWidth();
500 
502  virtual FXint getContentHeight();
503 
505  virtual FXint getVisibleX() const;
506 
508  virtual FXint getVisibleY() const;
509 
511  virtual FXint getVisibleWidth() const;
512 
514  virtual FXint getVisibleHeight() const;
515 
517  virtual FXint getDefaultWidth();
518 
520  virtual FXint getDefaultHeight();
521 
523  virtual void layout();
524 
526  virtual void recalc();
527 
529  virtual FXbool canFocus() const;
530 
532  virtual void setFocus();
533 
535  virtual void killFocus();
536 
538  FXButton* getCornerButton() const { return cornerButton; }
539 
541  FXHeader* getColumnHeader() const { return colHeader; }
542 
544  FXHeader* getRowHeader() const { return rowHeader; }
545 
547  void setVisibleRows(FXint nvrows);
548 
550  FXint getVisibleRows() const { return visiblerows; }
551 
553  void setVisibleColumns(FXint nvcols);
554 
556  FXint getVisibleColumns() const { return visiblecols; }
557 
559  FXbool isEditable() const;
560 
562  void setEditable(FXbool edit=true);
563 
565  void showHorzGrid(FXbool on=true);
566 
568  FXbool isHorzGridShown() const { return hgrid; }
569 
571  void showVertGrid(FXbool on=true);
572 
574  FXbool isVertGridShown() const { return vgrid; }
575 
577  FXint getNumRows() const { return nrows; }
578 
580  FXint getNumColumns() const { return ncols; }
581 
583  void setMarginTop(FXint pt);
584 
586  FXint getMarginTop() const { return margintop; }
587 
589  void setMarginBottom(FXint pb);
590 
592  FXint getMarginBottom() const { return marginbottom; }
593 
595  void setMarginLeft(FXint pl);
596 
598  FXint getMarginLeft() const { return marginleft; }
599 
601  void setMarginRight(FXint pr);
602 
604  FXint getMarginRight() const { return marginright; }
605 
614  virtual FXbool startInput(FXint row,FXint col);
615 
622  virtual FXbool cancelInput();
623 
633  virtual FXbool acceptInput(FXbool notify=false);
634 
640  FXint colAtX(FXint x) const;
641 
647  FXint rowAtY(FXint y) const;
648 
650  void setItem(FXint row,FXint col,FXTableItem* item,FXbool notify=false);
651 
653  FXTableItem *getItem(FXint row,FXint col) const;
654 
656  virtual void setTableSize(FXint nr,FXint nc,FXbool notify=false);
657 
659  virtual void insertRows(FXint row,FXint nr=1,FXbool notify=false);
660 
662  virtual void insertColumns(FXint col,FXint nc=1,FXbool notify=false);
663 
665  virtual void removeRows(FXint row,FXint nr=1,FXbool notify=false);
666 
668  virtual void removeColumns(FXint col,FXint nc=1,FXbool notify=false);
669 
671  virtual FXTableItem* extractItem(FXint row,FXint col,FXbool notify=false);
672 
674  virtual void removeItem(FXint row,FXint col,FXbool notify=false);
675 
677  virtual void removeRange(FXint startrow,FXint endrow,FXint startcol,FXint endcol,FXbool notify=false);
678 
680  virtual void clearItems(FXbool notify=false);
681 
683  virtual void makePositionVisible(FXint row,FXint col);
684 
686  FXbool isItemVisible(FXint row,FXint col) const;
687 
696  void setColumnHeaderMode(FXuint hint=LAYOUT_FIX_HEIGHT);
697 
699  FXuint getColumnHeaderMode() const;
700 
709  void setRowHeaderMode(FXuint hint=LAYOUT_FIX_WIDTH);
710 
712  FXuint getRowHeaderMode() const;
713 
715  void setColumnHeaderFont(FXFont* fnt);
716 
718  FXFont* getColumnHeaderFont() const;
719 
721  void setRowHeaderFont(FXFont* fnt);
722 
724  FXFont* getRowHeaderFont() const;
725 
727  void setColumnHeaderHeight(FXint h);
728 
730  FXint getColumnHeaderHeight() const;
731 
733  void setRowHeaderWidth(FXint w);
734 
736  FXint getRowHeaderWidth() const;
737 
739  FXint getColumnX(FXint col) const;
740 
742  FXint getRowY(FXint row) const;
743 
745  virtual void setColumnWidth(FXint col,FXint cwidth);
746 
748  FXint getColumnWidth(FXint col) const;
749 
751  virtual void setRowHeight(FXint row,FXint rheight);
752 
754  FXint getRowHeight(FXint row) const;
755 
757  void setDefColumnWidth(FXint cwidth);
758 
760  FXint getDefColumnWidth() const { return defColWidth; }
761 
763  void setDefRowHeight(FXint rheight);
764 
766  FXint getDefRowHeight() const { return defRowHeight; }
767 
769  FXint getMinRowHeight(FXint row) const;
770 
772  FXint getMinColumnWidth(FXint col) const;
773 
775  void fitRowsToContents(FXint row,FXint nr=1);
776 
778  void fitColumnsToContents(FXint col,FXint nc=1);
779 
781  void setColumnText(FXint col,const FXString& text);
782 
784  FXString getColumnText(FXint col) const;
785 
787  void setRowText(FXint row,const FXString& text);
788 
790  FXString getRowText(FXint row) const;
791 
793  void setColumnIcon(FXint col,FXIcon* icon);
794 
796  FXIcon* getColumnIcon(FXint col) const;
797 
799  void setRowIcon(FXint row,FXIcon* icon);
800 
802  FXIcon* getRowIcon(FXint row) const;
803 
805  void setColumnTipText(FXint col,const FXString& text);
806 
808  FXString getColumnTipText(FXint col) const;
809 
811  void setRowTipText(FXint row,const FXString& text);
812 
814  FXString getRowTipText(FXint row) const;
815 
817  void setColumnIconPosition(FXint col,FXuint m);
818 
820  FXuint getColumnIconPosition(FXint col) const;
821 
823  void setRowIconPosition(FXint row,FXuint m);
824 
826  FXuint getRowIconPosition(FXint row) const;
827 
829  void setColumnJustify(FXint col,FXuint justify);
830 
832  FXuint getColumnJustify(FXint col) const;
833 
835  void setRowJustify(FXint row,FXuint justify);
836 
838  FXuint getRowJustify(FXint row) const;
839 
841  void setItemText(FXint row,FXint col,const FXString& text,FXbool notify=false);
842 
844  FXString getItemText(FXint row,FXint col) const;
845 
847  void setItemTipText(FXint row,FXint col,const FXString& text);
848 
850  FXString getItemTipText(FXint row,FXint col) const;
851 
853  void setItemIcon(FXint row,FXint col,FXIcon* icon,FXbool owned=false,FXbool notify=false);
854 
856  FXIcon* getItemIcon(FXint row,FXint col) const;
857 
859  void setItemData(FXint row,FXint col,FXptr ptr);
860 
862  FXptr getItemData(FXint row,FXint col) const;
863 
868  void extractText(FXchar*& text,FXint& size,FXint startrow,FXint endrow,FXint startcol,FXint endcol,const FXchar* cs="\t",const FXchar* rs="\n") const;
869  void extractText(FXString& text,FXint startrow,FXint endrow,FXint startcol,FXint endcol,const FXchar* cs="\t",const FXchar* rs="\n") const;
870 
877  void overlayText(FXint startrow,FXint endrow,FXint startcol,FXint endcol,const FXchar* text,FXint size,const FXchar* cs="\t,",const FXchar* rs="\n",FXbool notify=false);
878  void overlayText(FXint startrow,FXint endrow,FXint startcol,FXint endcol,const FXString& text,const FXchar* cs="\t,",const FXchar* rs="\n",FXbool notify=false);
879 
885  void countText(FXint& nr,FXint& nc,const FXchar* text,FXint size,const FXchar* cs="\t,",const FXchar* rs="\n") const;
886  void countText(FXint& nr,FXint& nc,const FXString& text,const FXchar* cs="\t,",const FXchar* rs="\n") const;
887 
889  virtual FXbool setSpanningRange(FXint row,FXint col,FXint fr,FXint lr,FXint fc,FXint lc,FXbool notify=false);
890 
892  void getSpanningRange(FXint row,FXint col,FXint& fr,FXint& lr,FXint& fc,FXint& lc) const;
893 
895  FXbool isItemSpanning(FXint row,FXint col) const;
896 
898  FXbool isItemHorizontalSpanning(FXint row,FXint col) const;
899 
901  FXbool isItemVerticalSpanning(FXint row,FXint col) const;
902 
904  void updateRange(FXint sr,FXint er,FXint sc,FXint ec) const;
905 
907  void updateItem(FXint row,FXint col) const;
908 
910  virtual FXbool enableItem(FXint row,FXint col);
911 
913  virtual FXbool disableItem(FXint row,FXint col);
914 
916  FXbool isItemEnabled(FXint row,FXint col) const;
917 
925  void setItemJustify(FXint row,FXint col,FXuint justify);
926 
928  FXuint getItemJustify(FXint row,FXint col) const;
929 
937  void setItemIconPosition(FXint row,FXint col,FXuint m);
938 
940  FXuint getItemIconPosition(FXint row,FXint col) const;
941 
947  void setItemBorders(FXint row,FXint col,FXuint borders);
948 
950  FXuint getItemBorders(FXint row,FXint col) const;
951 
953  void setItemStipple(FXint row,FXint col,FXStipplePattern pat);
954 
956  FXStipplePattern getItemStipple(FXint row,FXint col) const;
957 
959  virtual void setCurrentItem(FXint row,FXint col,FXbool notify=false);
960 
962  FXint getCurrentRow() const { return current.row; }
963 
965  FXint getCurrentColumn() const { return current.col; }
966 
968  FXbool isItemCurrent(FXint row,FXint col) const;
969 
971  void setAnchorItem(FXint row,FXint col);
972 
974  FXint getAnchorRow() const { return anchor.row; }
975 
977  FXint getAnchorColumn() const { return anchor.col; }
978 
980  FXint getSelStartRow() const { return selection.fm.row; }
981 
983  FXint getSelStartColumn() const { return selection.fm.col; }
984 
986  FXint getSelEndRow() const { return selection.to.row; }
987 
989  FXint getSelEndColumn() const { return selection.to.col; }
990 
992  FXbool isItemSelected(FXint row,FXint col) const;
993 
995  FXbool isRowSelected(FXint row) const;
996 
998  FXbool isColumnSelected(FXint col) const;
999 
1001  FXbool isAnythingSelected() const;
1002 
1004  virtual FXbool selectCell(FXint row,FXint col,FXbool notify=false);
1005 
1007  virtual FXbool selectRow(FXint row,FXbool notify=false);
1008 
1010  virtual FXbool selectColumn(FXint col,FXbool notify=false);
1011 
1013  virtual FXbool selectRange(FXint nrlo,FXint nrhi,FXint nclo,FXint nchi,FXbool notify=false);
1014 
1016  virtual FXbool extendSelection(FXint row,FXint col,FXbool notify=false);
1017 
1019  virtual FXbool killSelection(FXbool notify=false);
1020 
1022  void setFont(FXFont* fnt);
1023 
1025  FXFont* getFont() const { return font; }
1026 
1028  FXColor getTextColor() const { return textColor; }
1029  FXColor getBaseColor() const { return baseColor; }
1030  FXColor getHiliteColor() const { return hiliteColor; }
1031  FXColor getShadowColor() const { return shadowColor; }
1032  FXColor getBorderColor() const { return borderColor; }
1033  FXColor getSelBackColor() const { return selbackColor; }
1034  FXColor getSelTextColor() const { return seltextColor; }
1035  FXColor getGridColor() const { return gridColor; }
1036  FXColor getStippleColor() const { return stippleColor; }
1037  FXColor getCellBorderColor() const { return cellBorderColor; }
1038 
1040  void setTextColor(FXColor clr);
1041  void setBaseColor(FXColor clr);
1042  void setHiliteColor(FXColor clr);
1043  void setShadowColor(FXColor clr);
1044  void setBorderColor(FXColor clr);
1045  void setSelBackColor(FXColor clr);
1046  void setSelTextColor(FXColor clr);
1047  void setGridColor(FXColor clr);
1048  void setStippleColor(FXColor clr);
1049  void setCellBorderColor(FXColor clr);
1050 
1052  void setCellColor(FXint row,FXint col,FXColor clr);
1053 
1055  FXColor getCellColor(FXint row,FXint col) const;
1056 
1058  void setCellBorderWidth(FXint borderwidth);
1059 
1061  FXint getCellBorderWidth() const { return cellBorderWidth; }
1062 
1064  void setTableStyle(FXuint style);
1065 
1067  FXuint getTableStyle() const;
1068 
1070  void setColumnRenumbering(FXNumberingFunc func);
1071 
1073  FXNumberingFunc getColumnRenumbering() const;
1074 
1076  void setRowRenumbering(FXNumberingFunc func);
1077 
1079  FXNumberingFunc getRowRenumbering() const;
1080 
1082  void setHelpText(const FXString& text){ help=text; }
1083  const FXString& getHelpText() const { return help; }
1084 
1086  virtual void save(FXStream& store) const;
1087  virtual void load(FXStream& store);
1088 
1089  virtual ~FXTable();
1090  };
1091 
1092 }
1093 
1094 #endif
FXint getSelStartColumn() const
Get selection start column; returns -1 if no selection.
Definition: FXTable.h:983
FXint getVisibleRows() const
return number of visible rows
Definition: FXTable.h:550
Combobox Item.
Definition: FXTable.h:221
void setTipText(const FXString &text)
Set the tool tip message for this item.
Definition: FXTable.h:129
Item in table.
Definition: FXTable.h:66
FXButton * getCornerButton() const
Return button in the top/left corner.
Definition: FXTable.h:538
FXptr getData() const
Get item&#39;s user data.
Definition: FXTable.h:138
FXTableItem(const FXString &text, FXIcon *ic=nullptr, FXptr ptr=nullptr)
Construct new table item.
Definition: FXTable.h:114
virtual FXIcon * getIcon() const
Return item&#39;s icon.
Definition: FXTable.h:126
FXint getDefRowHeight() const
Get default row height.
Definition: FXTable.h:766
FXint getMarginRight() const
Return right cell margin.
Definition: FXTable.h:604
FXbool isSelected() const
Return true if this item is selected.
Definition: FXTable.h:150
Window is the base class for all widgets in FOX.
Definition: FXWindow.h:130
A button provides a push button, with optional icon and/or text label.
Definition: FXButton.h:70
FXint getSelEndRow() const
Get selection end row; returns -1 if no selection.
Definition: FXTable.h:986
FXint getAnchorRow() const
Get row number of anchor item.
Definition: FXTable.h:974
Base composite.
Definition: FXComposite.h:32
The Table widget displays a table of items, each with a text and optional icon.
Definition: FXTable.h:288
FXint getMarginTop() const
Return top cell margin.
Definition: FXTable.h:586
Header control may be placed over a table or list to provide a resizable captions above a number of c...
Definition: FXHeader.h:198
FXuint getIconPosition() const
Return item icon position.
Definition: FXTable.h:174
void setData(FXptr ptr)
Change item&#39;s user data.
Definition: FXTable.h:135
FXint getCellBorderWidth() const
Return cell border width.
Definition: FXTable.h:1061
Range of table cells.
Definition: FXTable.h:59
FXint getVisibleColumns() const
Return number of visible columns.
Definition: FXTable.h:556
FXbool hasFocus() const
Return true if item has focus.
Definition: FXTable.h:144
FXint getMarginBottom() const
Return bottom cell margin.
Definition: FXTable.h:592
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
FXFont * getFont() const
Return current font.
Definition: FXTable.h:1025
Abstract Device Context.
Definition: FXDC.h:153
FXbool isDraggable() const
Return true if this item is draggable.
Definition: FXTable.h:162
void setHelpText(const FXString &text)
Change help text.
Definition: FXTable.h:1082
const FXString & getTipText() const
Get the tool tip message for this item.
Definition: FXTable.h:132
Definition: FX4Splitter.h:28
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:42
virtual FXString getText() const
Return item&#39;s text label.
Definition: FXTable.h:120
FXbool isVertGridShown() const
Is vertical grid shown.
Definition: FXTable.h:574
FXint getSelEndColumn() const
Get selection end column; returns -1 if no selection.
Definition: FXTable.h:989
FXint getNumColumns() const
Get number of columns.
Definition: FXTable.h:580
FXuint getBorders() const
Return item borders.
Definition: FXTable.h:180
The scroll area widget manages a content area and a viewport area through which the content is viewed...
Definition: FXScrollArea.h:69
FXHeader * getColumnHeader() const
Return column header control.
Definition: FXTable.h:541
FXint getSelStartRow() const
Get selection start row; returns -1 if no selection.
Definition: FXTable.h:980
FXint getCurrentColumn() const
Get column number of current item.
Definition: FXTable.h:965
FXbool isHorzGridShown() const
Is horizontal grid shown.
Definition: FXTable.h:568
const FXString & getSelections() const
Return selections.
Definition: FXTable.h:245
FXint getCurrentRow() const
Get row number of current item.
Definition: FXTable.h:962
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
FXint getNumRows() const
Get number of rows.
Definition: FXTable.h:577
Position in table.
Definition: FXTable.h:52
FXColor getTextColor() const
Obtain colors of various parts.
Definition: FXTable.h:1028
FXint getMarginLeft() const
Return left cell margin.
Definition: FXTable.h:598
FXint getDefColumnWidth() const
Get default column width.
Definition: FXTable.h:760
FXbool isEnabled() const
Return true if this item is enabled.
Definition: FXTable.h:156
FXHeader * getRowHeader() const
Return row header control.
Definition: FXTable.h:544
FXuint getJustify() const
Return item content justification.
Definition: FXTable.h:168
Font class.
Definition: FXFont.h:137
FXint getAnchorColumn() const
Get column number of anchor item.
Definition: FXTable.h:977
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp