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

/home/jeroen/FOX/fox/fox-1.7.33/include/FXTable.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                            T a b l e   W i d g e t                            *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1999,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXTABLE_H
00022 #define FXTABLE_H
00023 
00024 #ifndef FXSCROLLAREA_H
00025 #include "FXScrollArea.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00031 class FXIcon;
00032 class FXFont;
00033 class FXTable;
00034 class FXHeader;
00035 class FXButton;
00036 
00037 
00039 enum { DEFAULT_MARGIN = 2 };
00040 
00041 
00042 
00044 enum {
00045   TABLE_COL_SIZABLE     = 0x00100000,   
00046   TABLE_ROW_SIZABLE     = 0x00200000,   
00047   TABLE_NO_COLSELECT    = 0x00400000,   
00048   TABLE_NO_ROWSELECT    = 0x00800000,   
00049   TABLE_READONLY        = 0x01000000,   
00050   TABLE_COL_RENUMBER    = 0x02000000,   
00051   TABLE_ROW_RENUMBER    = 0x04000000    
00052   };
00053 
00054 
00056 struct FXTablePos {
00057   FXint  row;
00058   FXint  col;
00059   };
00060 
00061 
00063 struct FXTableRange {
00064   FXTablePos fm;
00065   FXTablePos to;
00066   };
00067 
00068 
00070 class FXAPI FXTableItem : public FXObject {
00071   FXDECLARE(FXTableItem)
00072   friend class FXTable;
00073 protected:
00074   FXString    label;
00075   FXIcon     *icon;
00076   void       *data;
00077   FXuint      state;
00078 private:
00079   FXTableItem(const FXTableItem&);
00080   FXTableItem& operator=(const FXTableItem&);
00081 protected:
00082   FXTableItem():icon(NULL),data(NULL),state(0){}
00083   FXint textWidth(const FXTable* table) const;
00084   FXint textHeight(const FXTable* table) const;
00085   virtual void draw(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
00086   virtual void drawBorders(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
00087   virtual void drawContent(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
00088   virtual void drawPattern(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
00089   virtual void drawBackground(const FXTable* table,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
00090 public:
00091   enum{
00092     SELECTED   = 0x00000001,    
00093     FOCUS      = 0x00000002,    
00094     DISABLED   = 0x00000004,    
00095     DRAGGABLE  = 0x00000008,    
00096     RESERVED1  = 0x00000010,    
00097     RESERVED2  = 0x00000020,    
00098     ICONOWNED  = 0x00000040,    
00099     RIGHT      = 0x00002000,    
00100     LEFT       = 0x00004000,    
00101     CENTER_X   = 0,             
00102     TOP        = 0x00008000,    
00103     BOTTOM     = 0x00010000,    
00104     CENTER_Y   = 0,             
00105     BEFORE     = 0x00020000,    
00106     AFTER      = 0x00040000,    
00107     ABOVE      = 0x00080000,    
00108     BELOW      = 0x00100000,    
00109     LBORDER    = 0x00200000,    
00110     RBORDER    = 0x00400000,    
00111     TBORDER    = 0x00800000,    
00112     BBORDER    = 0x01000000     
00113     };
00114 public:
00115 
00117   FXTableItem(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL):label(text),icon(ic),data(ptr),state(RIGHT|CENTER_Y){}
00118 
00120   virtual void setText(const FXString& txt);
00121 
00123   virtual FXString getText() const { return label; }
00124 
00126   virtual void setIcon(FXIcon* icn,FXbool owned=false);
00127 
00129   virtual FXIcon* getIcon() const { return icon; }
00130 
00132   void setData(void* ptr){ data=ptr; }
00133 
00135   void* getData() const { return data; }
00136 
00138   virtual void setFocus(FXbool focus);
00139 
00141   FXbool hasFocus() const { return (state&FOCUS)!=0; }
00142 
00144   virtual void setSelected(FXbool selected);
00145 
00147   FXbool isSelected() const { return (state&SELECTED)!=0; }
00148 
00150   virtual void setEnabled(FXbool enabled);
00151 
00153   FXbool isEnabled() const { return (state&DISABLED)==0; }
00154 
00156   virtual void setDraggable(FXbool draggable);
00157 
00159   FXbool isDraggable() const { return (state&DRAGGABLE)!=0; }
00160 
00162   virtual void setJustify(FXuint justify=RIGHT|CENTER_Y);
00163 
00165   FXuint getJustify() const { return state&(RIGHT|LEFT|TOP|BOTTOM); }
00166 
00168   virtual void setIconPosition(FXuint mode);
00169 
00171   FXuint getIconPosition() const { return state&(BEFORE|AFTER|ABOVE|BELOW); }
00172 
00174   virtual void setBorders(FXuint borders=0);
00175 
00177   FXuint getBorders() const { return state&(LBORDER|RBORDER|TBORDER|BBORDER); }
00178 
00180   virtual void setStipple(FXStipplePattern pattern);
00181 
00183   FXStipplePattern getStipple() const;
00184 
00186   virtual FXWindow* getControlFor(FXTable* table);
00187 
00189   virtual void setFromControl(FXWindow* control);
00190 
00192   virtual FXint getWidth(const FXTable* table) const;
00193 
00195   virtual FXint getHeight(const FXTable* table) const;
00196 
00198   virtual void create();
00199 
00201   virtual void detach();
00202 
00204   virtual void destroy();
00205 
00207   virtual void save(FXStream& store) const;
00208 
00210   virtual void load(FXStream& store);
00211 
00213   virtual ~FXTableItem();
00214   };
00215 
00216 
00218 class FXAPI FXComboTableItem : public FXTableItem {
00219   FXDECLARE(FXComboTableItem)
00220 protected:
00221   FXString selections;
00222 private:
00223   FXComboTableItem(const FXComboTableItem&);
00224   FXComboTableItem& operator=(const FXComboTableItem&);
00225 protected:
00226   FXComboTableItem(){}
00227 public:
00228 
00230   FXComboTableItem(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
00231 
00233   virtual FXWindow *getControlFor(FXTable* table);
00234 
00236   virtual void setFromControl(FXWindow *control);
00237 
00239   void setSelections(const FXString& strings);
00240 
00242   const FXString& getSelections() const { return selections; }
00243   };
00244 
00245 
00282 class FXAPI FXTable : public FXScrollArea {
00283   FXDECLARE(FXTable)
00284 protected:
00285   FXHeader     *colHeader;              // Column header
00286   FXHeader     *rowHeader;              // Row header
00287   FXButton     *cornerButton;           // Corner button
00288   FXTableItem **cells;                  // Cells
00289   FXWindow     *editor;                 // Editor widget
00290   FXFont       *font;                   // Font
00291   FXint         nrows;                  // Number of rows
00292   FXint         ncols;                  // Number of columns
00293   FXint         visiblerows;            // Visible rows
00294   FXint         visiblecols;            // Visible columns
00295   FXint         margintop;              // Margin top
00296   FXint         marginbottom;           // Margin bottom
00297   FXint         marginleft;             // Margin left
00298   FXint         marginright;            // Margin right
00299   FXColor       textColor;              // Normal text color
00300   FXColor       baseColor;              // Base color
00301   FXColor       hiliteColor;            // Highlight color
00302   FXColor       shadowColor;            // Shadow color
00303   FXColor       borderColor;            // Border color
00304   FXColor       selbackColor;           // Select background color
00305   FXColor       seltextColor;           // Select text color
00306   FXColor       gridColor;              // Grid line color
00307   FXColor       stippleColor;           // Stipple color
00308   FXColor       cellBorderColor;        // Cell border color
00309   FXint         cellBorderWidth;        // Cell border width
00310   FXColor       cellBackColor[2][2];    // Row/Column even/odd background color
00311   FXint         defColWidth;            // Default column width [if uniform columns]
00312   FXint         defRowHeight;           // Default row height [if uniform rows]
00313   FXTablePos    current;                // Current position
00314   FXTablePos    anchor;                 // Anchor position
00315   FXTableRange  input;                  // Input cell
00316   FXTableRange  selection;              // Range of selected cells
00317   FXString      clipped;                // Clipped text
00318   FXbool        hgrid;                  // Horizontal grid lines shown
00319   FXbool        vgrid;                  // Vertical grid lines shown
00320   FXuchar       mode;                   // Mode widget is in
00321   FXint         grabx;                  // Grab point x
00322   FXint         graby;                  // Grab point y
00323   FXint         rowcol;                 // Row or column being resized
00324   FXString      help;
00325 public:
00326   static FXDragType csvType;
00327   static const FXchar csvTypeName[];
00328 protected:
00329   FXTable();
00330   FXint startRow(FXint row,FXint col) const;
00331   FXint startCol(FXint row,FXint col) const;
00332   FXint endRow(FXint row,FXint col) const;
00333   FXint endCol(FXint row,FXint col) const;
00334   void spanningRange(FXint& sr,FXint& er,FXint& sc,FXint& ec,FXint anchrow,FXint anchcol,FXint currow,FXint curcol);
00335   virtual void moveContents(FXint x,FXint y);
00336   virtual void drawCell(FXDC& dc,FXint sr,FXint er,FXint sc,FXint ec);
00337   virtual void drawRange(FXDC& dc,FXint rlo,FXint rhi,FXint clo,FXint chi);
00338   virtual void drawHGrid(FXDC& dc,FXint rlo,FXint rhi,FXint clo,FXint chi);
00339   virtual void drawVGrid(FXDC& dc,FXint rlo,FXint rhi,FXint clo,FXint chi);
00340   virtual void drawContents(FXDC& dc,FXint x,FXint y,FXint w,FXint h);
00341   virtual FXTableItem* createItem(const FXString& text,FXIcon* icon,void* ptr);
00342   virtual FXWindow* getControlForItem(FXint r,FXint c);
00343   virtual void setItemFromControl(FXint r,FXint c,FXWindow* control);
00344   virtual void updateColumnNumbers(FXint lo,FXint hi);
00345   virtual void updateRowNumbers(FXint lo,FXint hi);
00346 protected:
00347   enum {
00348     MOUSE_NONE,
00349     MOUSE_SCROLL,
00350     MOUSE_DRAG,
00351     MOUSE_SELECT
00352     };
00353 private:
00354   FXTable(const FXTable&);
00355   FXTable& operator=(const FXTable&);
00356 public:
00357   long onPaint(FXObject*,FXSelector,void*);
00358   long onEnter(FXObject*,FXSelector,void*);
00359   long onLeave(FXObject*,FXSelector,void*);
00360   long onFocusIn(FXObject*,FXSelector,void*);
00361   long onFocusOut(FXObject*,FXSelector,void*);
00362   long onMotion(FXObject*,FXSelector,void*);
00363   long onKeyPress(FXObject*,FXSelector,void*);
00364   long onKeyRelease(FXObject*,FXSelector,void*);
00365   long onLeftBtnPress(FXObject*,FXSelector,void*);
00366   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00367   long onRightBtnPress(FXObject*,FXSelector,void*);
00368   long onRightBtnRelease(FXObject*,FXSelector,void*);
00369   long onUngrabbed(FXObject*,FXSelector,void*);
00370   long onSelectionLost(FXObject*,FXSelector,void*);
00371   long onSelectionGained(FXObject*,FXSelector,void*);
00372   long onSelectionRequest(FXObject*,FXSelector,void* ptr);
00373   long onClipboardLost(FXObject*,FXSelector,void*);
00374   long onClipboardGained(FXObject*,FXSelector,void*);
00375   long onClipboardRequest(FXObject*,FXSelector,void*);
00376   long onAutoScroll(FXObject*,FXSelector,void*);
00377   long onCommand(FXObject*,FXSelector,void*);
00378   long onClicked(FXObject*,FXSelector,void*);
00379   long onDoubleClicked(FXObject*,FXSelector,void*);
00380   long onTripleClicked(FXObject*,FXSelector,void*);
00381   long onQueryTip(FXObject*,FXSelector,void*);
00382   long onQueryHelp(FXObject*,FXSelector,void*);
00383   long onTipTimer(FXObject*,FXSelector,void*);
00384 
00385   long onCmdToggleEditable(FXObject*,FXSelector,void*);
00386   long onUpdToggleEditable(FXObject*,FXSelector,void*);
00387 
00388   // Visual characteristics
00389   long onCmdHorzGrid(FXObject*,FXSelector,void*);
00390   long onUpdHorzGrid(FXObject*,FXSelector,void*);
00391   long onCmdVertGrid(FXObject*,FXSelector,void*);
00392   long onUpdVertGrid(FXObject*,FXSelector,void*);
00393 
00394   // Row/Column manipulations
00395   long onCmdDeleteColumn(FXObject*,FXSelector,void*);
00396   long onUpdDeleteColumn(FXObject*,FXSelector,void*);
00397   long onCmdDeleteRow(FXObject*,FXSelector,void*);
00398   long onUpdDeleteRow(FXObject*,FXSelector,void*);
00399   long onCmdInsertColumn(FXObject*,FXSelector,void*);
00400   long onUpdInsertColumn(FXObject*,FXSelector,void*);
00401   long onCmdInsertRow(FXObject*,FXSelector,void*);
00402   long onUpdInsertRow(FXObject*,FXSelector,void*);
00403 
00404   // Movement
00405   long onCmdMoveRight(FXObject*,FXSelector,void*);
00406   long onCmdMoveLeft(FXObject*,FXSelector,void*);
00407   long onCmdMoveUp(FXObject*,FXSelector,void*);
00408   long onCmdMoveDown(FXObject*,FXSelector,void*);
00409   long onCmdMoveHome(FXObject*,FXSelector,void*);
00410   long onCmdMoveEnd(FXObject*,FXSelector,void*);
00411   long onCmdMoveTop(FXObject*,FXSelector,void*);
00412   long onCmdMoveBottom(FXObject*,FXSelector,void*);
00413   long onCmdMovePageDown(FXObject*,FXSelector,void*);
00414   long onCmdMovePageUp(FXObject*,FXSelector,void*);
00415 
00416   // Mark and extend
00417   long onCmdMark(FXObject*,FXSelector,void*);
00418   long onCmdExtend(FXObject*,FXSelector,void*);
00419 
00420   // Changing Selection
00421   long onUpdSelectCell(FXObject*,FXSelector,void*);
00422   long onCmdSelectCell(FXObject*,FXSelector,void*);
00423   long onUpdSelectRow(FXObject*,FXSelector,void*);
00424   long onCmdSelectRow(FXObject*,FXSelector,void*);
00425   long onUpdSelectColumn(FXObject*,FXSelector,void*);
00426   long onCmdSelectColumn(FXObject*,FXSelector,void*);
00427   long onCmdSelectRowIndex(FXObject*,FXSelector,void*);
00428   long onCmdSelectColumnIndex(FXObject*,FXSelector,void*);
00429   long onUpdSelectAll(FXObject*,FXSelector,void*);
00430   long onCmdSelectAll(FXObject*,FXSelector,void*);
00431   long onUpdDeselectAll(FXObject*,FXSelector,void*);
00432   long onCmdDeselectAll(FXObject*,FXSelector,void*);
00433 
00434   // Manipulation Selection
00435   long onCmdCutSel(FXObject*,FXSelector,void*);
00436   long onCmdCopySel(FXObject*,FXSelector,void*);
00437   long onCmdDeleteSel(FXObject*,FXSelector,void*);
00438   long onCmdPasteSel(FXObject*,FXSelector,void*);
00439   long onUpdHaveSelection(FXObject*,FXSelector,void*);
00440 
00441   // Edit control
00442   long onCmdStartInput(FXObject*,FXSelector,void*);
00443   long onUpdStartInput(FXObject*,FXSelector,void*);
00444   long onCmdAcceptInput(FXObject*,FXSelector,void*);
00445   long onUpdAcceptInput(FXObject*,FXSelector,void*);
00446   long onCmdCancelInput(FXObject*,FXSelector,void*);
00447 public:
00448 
00449   enum {
00450     ID_HORZ_GRID=FXScrollArea::ID_LAST,
00451     ID_VERT_GRID,
00452     ID_TOGGLE_EDITABLE,
00453     ID_DELETE_COLUMN,
00454     ID_DELETE_ROW,
00455     ID_INSERT_COLUMN,
00456     ID_INSERT_ROW,
00457     ID_SELECT_COLUMN_INDEX,
00458     ID_SELECT_ROW_INDEX,
00459     ID_SELECT_COLUMN,
00460     ID_SELECT_ROW,
00461     ID_SELECT_CELL,
00462     ID_SELECT_ALL,
00463     ID_DESELECT_ALL,
00464     ID_MOVE_LEFT,
00465     ID_MOVE_RIGHT,
00466     ID_MOVE_UP,
00467     ID_MOVE_DOWN,
00468     ID_MOVE_HOME,
00469     ID_MOVE_END,
00470     ID_MOVE_TOP,
00471     ID_MOVE_BOTTOM,
00472     ID_MOVE_PAGEDOWN,
00473     ID_MOVE_PAGEUP,
00474     ID_START_INPUT,
00475     ID_CANCEL_INPUT,
00476     ID_ACCEPT_INPUT,
00477     ID_MARK,
00478     ID_EXTEND,
00479     ID_CUT_SEL,
00480     ID_COPY_SEL,
00481     ID_PASTE_SEL,
00482     ID_DELETE_SEL,
00483     ID_LAST
00484     };
00485 
00486 public:
00487 
00493   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);
00494 
00496   virtual FXint getDefaultWidth();
00497 
00499   virtual FXint getDefaultHeight();
00500 
00502   virtual FXint getContentWidth();
00503 
00505   virtual FXint getContentHeight();
00506 
00508   virtual FXint getVisibleX() const;
00509 
00511   virtual FXint getVisibleY() const;
00512 
00514   virtual FXint getVisibleWidth() const;
00515 
00517   virtual FXint getVisibleHeight() const;
00518 
00520   virtual void create();
00521 
00523   virtual void detach();
00524 
00526   virtual void layout();
00527 
00529   virtual void recalc();
00530 
00532   virtual FXbool canFocus() const;
00533 
00535   virtual void setFocus();
00536 
00538   virtual void killFocus();
00539 
00541   virtual void changeFocus(FXWindow *child);
00542 
00544   FXButton* getCornerButton() const { return cornerButton; }
00545 
00547   FXHeader* getColumnHeader() const { return colHeader; }
00548 
00550   FXHeader* getRowHeader() const { return rowHeader; }
00551 
00553   void setVisibleRows(FXint nvrows);
00554 
00556   FXint getVisibleRows() const { return visiblerows; }
00557 
00559   void setVisibleColumns(FXint nvcols);
00560 
00562   FXint getVisibleColumns() const { return visiblecols; }
00563 
00565   FXbool isEditable() const;
00566 
00568   void setEditable(FXbool edit=true);
00569 
00571   void showHorzGrid(FXbool on=true);
00572 
00574   FXbool isHorzGridShown() const { return hgrid; }
00575 
00577   void showVertGrid(FXbool on=true);
00578 
00580   FXbool isVertGridShown() const { return vgrid; }
00581 
00583   FXint getNumRows() const { return nrows; }
00584 
00586   FXint getNumColumns() const { return ncols; }
00587 
00589   void setMarginTop(FXint pt);
00590 
00592   FXint getMarginTop() const { return margintop; }
00593 
00595   void setMarginBottom(FXint pb);
00596 
00598   FXint getMarginBottom() const { return marginbottom; }
00599 
00601   void setMarginLeft(FXint pl);
00602 
00604   FXint getMarginLeft() const { return marginleft; }
00605 
00607   void setMarginRight(FXint pr);
00608 
00610   FXint getMarginRight() const { return marginright; }
00611 
00620   virtual FXbool startInput(FXint row,FXint col);
00621 
00628   virtual FXbool cancelInput();
00629 
00639   virtual FXbool acceptInput(FXbool notify=false);
00640 
00646   FXint colAtX(FXint x) const;
00647 
00653   FXint rowAtY(FXint y) const;
00654 
00656   FXTableItem *getItem(FXint row,FXint col) const;
00657 
00659   void setItem(FXint row,FXint col,FXTableItem* item,FXbool notify=false);
00660 
00662   virtual void setTableSize(FXint nr,FXint nc,FXbool notify=false);
00663 
00665   virtual void insertRows(FXint row,FXint nr=1,FXbool notify=false);
00666 
00668   virtual void insertColumns(FXint col,FXint nc=1,FXbool notify=false);
00669 
00671   virtual void removeRows(FXint row,FXint nr=1,FXbool notify=false);
00672 
00674   virtual void removeColumns(FXint col,FXint nc=1,FXbool notify=false);
00675 
00677   virtual FXTableItem* extractItem(FXint row,FXint col,FXbool notify=false);
00678 
00680   virtual void removeItem(FXint row,FXint col,FXbool notify=false);
00681 
00683   virtual void removeRange(FXint startrow,FXint endrow,FXint startcol,FXint endcol,FXbool notify=false);
00684 
00686   virtual void clearItems(FXbool notify=false);
00687 
00689   virtual void makePositionVisible(FXint r,FXint c);
00690 
00692   FXbool isItemVisible(FXint r,FXint c) const;
00693 
00702   void setColumnHeaderMode(FXuint hint=LAYOUT_FIX_HEIGHT);
00703 
00705   FXuint getColumnHeaderMode() const;
00706 
00715   void setRowHeaderMode(FXuint hint=LAYOUT_FIX_WIDTH);
00716 
00718   FXuint getRowHeaderMode() const;
00719 
00721   void setColumnHeaderFont(FXFont* fnt);
00722 
00724   FXFont* getColumnHeaderFont() const;
00725 
00727   void setRowHeaderFont(FXFont* fnt);
00728 
00730   FXFont* getRowHeaderFont() const;
00731 
00733   void setColumnHeaderHeight(FXint h);
00734 
00736   FXint getColumnHeaderHeight() const;
00737 
00739   void setRowHeaderWidth(FXint w);
00740 
00742   FXint getRowHeaderWidth() const;
00743 
00745   FXint getColumnX(FXint col) const;
00746 
00748   FXint getRowY(FXint row) const;
00749 
00751   virtual void setColumnWidth(FXint col,FXint cwidth);
00752 
00754   FXint getColumnWidth(FXint col) const;
00755 
00757   virtual void setRowHeight(FXint row,FXint rheight);
00758 
00760   FXint getRowHeight(FXint row) const;
00761 
00763   void setDefColumnWidth(FXint cwidth);
00764 
00766   FXint getDefColumnWidth() const { return defColWidth; }
00767 
00769   void setDefRowHeight(FXint rheight);
00770 
00772   FXint getDefRowHeight() const { return defRowHeight; }
00773 
00775   FXint getMinRowHeight(FXint r) const;
00776 
00778   FXint getMinColumnWidth(FXint c) const;
00779 
00781   void fitRowsToContents(FXint row,FXint nr=1);
00782 
00784   void fitColumnsToContents(FXint col,FXint nc=1);
00785 
00787   void setColumnText(FXint index,const FXString& text);
00788 
00790   FXString getColumnText(FXint index) const;
00791 
00793   void setRowText(FXint index,const FXString& text);
00794 
00796   FXString getRowText(FXint index) const;
00797 
00799   void setColumnIcon(FXint index,FXIcon* icon);
00800 
00802   FXIcon* getColumnIcon(FXint index) const;
00803 
00805   void setRowIcon(FXint index,FXIcon* icon);
00806 
00808   FXIcon* getRowIcon(FXint index) const;
00809 
00811   void setColumnTipText(FXint index,const FXString& text);
00812 
00814   FXString getColumnTipText(FXint index) const;
00815 
00817   void setRowTipText(FXint index,const FXString& text);
00818 
00820   FXString getRowTipText(FXint index) const;
00821 
00823   void setColumnIconPosition(FXint index,FXuint m);
00824 
00826   FXuint getColumnIconPosition(FXint index) const;
00827 
00829   void setRowIconPosition(FXint index,FXuint m);
00830 
00832   FXuint getRowIconPosition(FXint index) const;
00833 
00835   void setColumnJustify(FXint index,FXuint justify);
00836 
00838   FXuint getColumnJustify(FXint index) const;
00839 
00841   void setRowJustify(FXint index,FXuint justify);
00842 
00844   FXuint getRowJustify(FXint index) const;
00845 
00847   void setItemText(FXint r,FXint c,const FXString& text,FXbool notify=false);
00848 
00850   FXString getItemText(FXint r,FXint c) const;
00851 
00853   void setItemIcon(FXint r,FXint c,FXIcon* icon,FXbool owned=false,FXbool notify=false);
00854 
00856   FXIcon* getItemIcon(FXint r,FXint c) const;
00857 
00859   void setItemData(FXint r,FXint c,void* ptr);
00860   void* getItemData(FXint r,FXint c) const;
00861 
00866   void extractText(FXchar*& text,FXint& size,FXint startrow,FXint endrow,FXint startcol,FXint endcol,const FXchar* cs="\t",const FXchar* rs="\n") const;
00867   void extractText(FXString& text,FXint startrow,FXint endrow,FXint startcol,FXint endcol,const FXchar* cs="\t",const FXchar* rs="\n") const;
00868 
00875   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);
00876   void overlayText(FXint startrow,FXint endrow,FXint startcol,FXint endcol,const FXString& text,const FXchar* cs="\t,",const FXchar* rs="\n",FXbool notify=false);
00877 
00883   void countText(FXint& nr,FXint& nc,const FXchar* text,FXint size,const FXchar* cs="\t,",const FXchar* rs="\n") const;
00884   void countText(FXint& nr,FXint& nc,const FXString& text,const FXchar* cs="\t,",const FXchar* rs="\n") const;
00885 
00887   FXbool isItemSpanning(FXint r,FXint c) const;
00888 
00890   void updateRange(FXint sr,FXint er,FXint sc,FXint ec) const;
00891 
00893   void updateItem(FXint r,FXint c) const;
00894 
00896   virtual FXbool enableItem(FXint r,FXint c);
00897 
00899   virtual FXbool disableItem(FXint r,FXint c);
00900 
00902   FXbool isItemEnabled(FXint r,FXint c) const;
00903 
00911   void setItemJustify(FXint r,FXint c,FXuint justify);
00912 
00914   FXuint getItemJustify(FXint r,FXint c) const;
00915 
00923   void setItemIconPosition(FXint r,FXint c,FXuint m);
00924 
00926   FXuint getItemIconPosition(FXint r,FXint c) const;
00927 
00933   void setItemBorders(FXint r,FXint c,FXuint borders);
00934 
00936   FXuint getItemBorders(FXint r,FXint c) const;
00937 
00939   void setItemStipple(FXint r,FXint c,FXStipplePattern pat);
00940 
00942   FXStipplePattern getItemStipple(FXint r,FXint c) const;
00943 
00945   virtual void setCurrentItem(FXint r,FXint c,FXbool notify=false);
00946 
00948   FXint getCurrentRow() const { return current.row; }
00949 
00951   FXint getCurrentColumn() const { return current.col; }
00952 
00954   FXbool isItemCurrent(FXint r,FXint c) const;
00955 
00957   void setAnchorItem(FXint r,FXint c);
00958 
00960   FXint getAnchorRow() const { return anchor.row; }
00961 
00963   FXint getAnchorColumn() const { return anchor.col; }
00964 
00966   FXint getSelStartRow() const { return selection.fm.row; }
00967 
00969   FXint getSelStartColumn() const { return selection.fm.col; }
00970 
00972   FXint getSelEndRow() const { return selection.to.row; }
00973 
00975   FXint getSelEndColumn() const { return selection.to.col; }
00976 
00978   FXbool isItemSelected(FXint r,FXint c) const;
00979 
00981   FXbool isRowSelected(FXint r) const;
00982 
00984   FXbool isColumnSelected(FXint c) const;
00985 
00987   FXbool isAnythingSelected() const;
00988 
00990   virtual FXbool selectRow(FXint row,FXbool notify=false);
00991 
00993   virtual FXbool selectColumn(FXint col,FXbool notify=false);
00994 
00996   virtual FXbool selectRange(FXint startrow,FXint endrow,FXint startcol,FXint endcol,FXbool notify=false);
00997 
00999   virtual FXbool extendSelection(FXint r,FXint c,FXbool notify=false);
01000 
01002   virtual FXbool killSelection(FXbool notify=false);
01003 
01005   void setFont(FXFont* fnt);
01006 
01008   FXFont* getFont() const { return font; }
01009 
01011   FXColor getTextColor() const { return textColor; }
01012   FXColor getBaseColor() const { return baseColor; }
01013   FXColor getHiliteColor() const { return hiliteColor; }
01014   FXColor getShadowColor() const { return shadowColor; }
01015   FXColor getBorderColor() const { return borderColor; }
01016   FXColor getSelBackColor() const { return selbackColor; }
01017   FXColor getSelTextColor() const { return seltextColor; }
01018   FXColor getGridColor() const { return gridColor; }
01019   FXColor getStippleColor() const { return stippleColor; }
01020   FXColor getCellBorderColor() const { return cellBorderColor; }
01021 
01023   void setTextColor(FXColor clr);
01024   void setBaseColor(FXColor clr);
01025   void setHiliteColor(FXColor clr);
01026   void setShadowColor(FXColor clr);
01027   void setBorderColor(FXColor clr);
01028   void setSelBackColor(FXColor clr);
01029   void setSelTextColor(FXColor clr);
01030   void setGridColor(FXColor clr);
01031   void setStippleColor(FXColor clr);
01032   void setCellBorderColor(FXColor clr);
01033 
01035   void setCellColor(FXint r,FXint c,FXColor clr);
01036 
01038   FXColor getCellColor(FXint r,FXint c) const;
01039 
01041   void setCellBorderWidth(FXint borderwidth);
01042 
01044   FXint getCellBorderWidth() const { return cellBorderWidth; }
01045 
01047   void setTableStyle(FXuint style);
01048 
01050   FXuint getTableStyle() const;
01051 
01053   void setColumnRenumbering(FXbool flag);
01054 
01056   FXbool getColumnRenumbering() const;
01057 
01059   void setRowRenumbering(FXbool flag);
01060 
01062   FXbool getRowRenumbering() const;
01063 
01065   void setHelpText(const FXString& text){ help=text; }
01066   const FXString& getHelpText() const { return help; }
01067 
01069   virtual void save(FXStream& store) const;
01070   virtual void load(FXStream& store);
01071 
01072   virtual ~FXTable();
01073   };
01074 
01075 }
01076 
01077 #endif

Copyright © 1997-2011 Jeroen van der Zijp