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

FXTable.h

00001 /******************************************************************************** 00002 * * 00003 * T a b l e W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1999,2004 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (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 GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXTable.h,v 1.130 2004/03/29 17:39:40 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXTABLE_H 00025 #define FXTABLE_H 00026 00027 #ifndef FXSCROLLAREA_H 00028 #include "FXScrollArea.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 ////////////////////////////// UNDER DEVELOPMENT ////////////////////////////// 00035 00036 class FXIcon; 00037 class FXFont; 00038 class FXTable; 00039 class FXHeader; 00040 class FXButton; 00041 00042 00043 /// Default cell margin 00044 enum { DEFAULT_MARGIN = 2 }; 00045 00046 00047 00048 /// Table options 00049 enum { 00050 TABLE_COL_SIZABLE = 0x00100000, /// Columns are resizable 00051 TABLE_ROW_SIZABLE = 0x00200000, /// Rows are resizable 00052 TABLE_HEADERS_SIZABLE = 0x00400000, /// Headers are sizable 00053 TABLE_NO_COLSELECT = 0x00900000, /// Disallow column selections 00054 TABLE_NO_ROWSELECT = 0x01000000 /// Disallow row selections 00055 }; 00056 00057 00058 /// Position in table 00059 struct FXTablePos { 00060 FXint row; 00061 FXint col; 00062 }; 00063 00064 00065 /// Range of table cells 00066 struct FXTableRange { 00067 FXTablePos fm; 00068 FXTablePos to; 00069 }; 00070 00071 00072 /// Item in table 00073 class FXAPI FXTableItem : public FXObject { 00074 FXDECLARE(FXTableItem) 00075 friend class FXTable; 00076 protected: 00077 FXString label; 00078 FXIcon *icon; 00079 void *data; 00080 FXuint state; 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 protected: 00091 enum{ 00092 SELECTED = 0x00000001, 00093 FOCUS = 0x00000002, 00094 DISABLED = 0x00000004, 00095 DRAGGABLE = 0x00000008, 00096 RESERVED1 = 0x00000010, 00097 RESERVED2 = 0x00000020, 00098 ICONOWNED = 0x00000040 00099 }; 00100 public: 00101 enum{ 00102 RIGHT = 0x00002000, /// Align on right 00103 LEFT = 0x00004000, /// Align on left 00104 CENTER_X = 0, /// Aling centered horizontally (default) 00105 TOP = 0x00008000, /// Align on top 00106 BOTTOM = 0x00010000, /// Align on bottom 00107 CENTER_Y = 0, /// Aling centered vertically (default) 00108 BEFORE = 0x00020000, /// Icon before the text 00109 AFTER = 0x00040000, /// Icon after the text 00110 ABOVE = 0x00080000, /// Icon above the text 00111 BELOW = 0x00100000, /// Icon below the text 00112 LBORDER = 0x00200000, /// Draw left border 00113 RBORDER = 0x00400000, /// Draw right border 00114 TBORDER = 0x00800000, /// Draw top border 00115 BBORDER = 0x01000000 /// Draw bottom border 00116 }; 00117 public: 00118 FXTableItem(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL):label(text),icon(ic),data(ptr),state(FXTableItem::RIGHT){} 00119 virtual void setText(const FXString& txt){ label=txt; } 00120 const FXString& getText() const { return label; } 00121 virtual void setIcon(FXIcon* icn){ icon=icn; } 00122 FXIcon* getIcon() const { return icon; } 00123 void setData(void* ptr){ data=ptr; } 00124 void* getData() const { return data; } 00125 virtual void setFocus(FXbool focus); 00126 FXbool hasFocus() const { return (state&FOCUS)!=0; } 00127 virtual void setSelected(FXbool selected); 00128 FXbool isSelected() const { return (state&SELECTED)!=0; } 00129 virtual void setEnabled(FXbool enabled); 00130 FXbool isEnabled() const { return (state&DISABLED)==0; } 00131 virtual void setDraggable(FXbool draggable); 00132 FXbool isDraggable() const { return (state&DRAGGABLE)!=0; } 00133 void setJustify(FXuint justify); 00134 FXuint getJustify() const { return state&(RIGHT|LEFT|TOP|BOTTOM); } 00135 void setIconPosition(FXuint mode); 00136 FXuint getIconPosition() const { return state&(BEFORE|AFTER|ABOVE|BELOW); } 00137 void setBorders(FXuint borders); 00138 FXuint getBorders() const { return state&(LBORDER|RBORDER|TBORDER|BBORDER); } 00139 void setStipple(FXStipplePattern pattern); 00140 FXStipplePattern getStipple() const; 00141 virtual void setIconOwned(FXuint owned=ICONOWNED); 00142 FXuint isIconOwned() const { return (state&ICONOWNED); } 00143 virtual FXint getWidth(const FXTable* table) const; 00144 virtual FXint getHeight(const FXTable* table) const; 00145 virtual void create(); 00146 virtual void detach(); 00147 virtual void destroy(); 00148 virtual void save(FXStream& store) const; 00149 virtual void load(FXStream& store); 00150 virtual ~FXTableItem(); 00151 }; 00152 00153 00154 00155 /// Table Widget 00156 class FXAPI FXTable : public FXScrollArea { 00157 FXDECLARE(FXTable) 00158 protected: 00159 FXHeader *colHeader; // Column header 00160 FXHeader *rowHeader; // Row header 00161 FXButton *cornerButton; // Corner button 00162 FXTableItem **cells; // Cells 00163 FXFont *font; // Font 00164 FXint nrows; // Number of rows 00165 FXint ncols; // Number of columns 00166 FXint visiblerows; // Visible rows 00167 FXint visiblecols; // Visible columns 00168 FXint margintop; // Margin top 00169 FXint marginbottom; // Margin bottom 00170 FXint marginleft; // Margin left 00171 FXint marginright; // Margin right 00172 FXColor textColor; // Normal text color 00173 FXColor baseColor; // Base color 00174 FXColor hiliteColor; // Highlight color 00175 FXColor shadowColor; // Shadow color 00176 FXColor borderColor; // Border color 00177 FXColor selbackColor; // Select background color 00178 FXColor seltextColor; // Select text color 00179 FXColor gridColor; // Grid line color 00180 FXColor stippleColor; // Stipple color 00181 FXColor cellBorderColor; // Cell border color 00182 FXint cellBorderWidth; // Cell border width 00183 FXColor cellBackColor[2][2]; // Row/Column even/odd background color 00184 FXint defColWidth; // Default column width [if uniform columns] 00185 FXint defRowHeight; // Default row height [if uniform rows] 00186 FXTablePos current; // Current position 00187 FXTablePos anchor; // Anchor position 00188 FXTableRange selection; // Range of selected cells 00189 FXchar *clipbuffer; // Clipped text 00190 FXint cliplength; // Length of clipped text 00191 FXbool hgrid; // Horizontal grid lines shown 00192 FXbool vgrid; // Vertical grid lines shown 00193 FXuchar mode; // Mode widget is in 00194 FXint grabx; // Grab point x 00195 FXint graby; // Grab point y 00196 FXint rowcol; // Row or column being resized 00197 FXString help; 00198 public: 00199 static FXDragType csvType; 00200 static const FXchar csvTypeName[]; 00201 protected: 00202 FXTable(); 00203 FXint startRow(FXint row,FXint col) const; 00204 FXint startCol(FXint row,FXint col) const; 00205 FXint endRow(FXint row,FXint col) const; 00206 FXint endCol(FXint row,FXint col) const; 00207 void spanningRange(FXint& sr,FXint& er,FXint& sc,FXint& ec,FXint anchrow,FXint anchcol,FXint currow,FXint curcol); 00208 virtual void moveContents(FXint x,FXint y); 00209 virtual void drawCell(FXDC& dc,FXint sr,FXint er,FXint sc,FXint ec); 00210 virtual void drawRange(FXDC& dc,FXint rlo,FXint rhi,FXint clo,FXint chi); 00211 virtual void drawHGrid(FXDC& dc,FXint rlo,FXint rhi,FXint clo,FXint chi); 00212 virtual void drawVGrid(FXDC& dc,FXint rlo,FXint rhi,FXint clo,FXint chi); 00213 virtual void drawContents(FXDC& dc,FXint x,FXint y,FXint w,FXint h); 00214 virtual FXTableItem* createItem(const FXString& text,FXIcon* icon,void* ptr); 00215 void countText(FXint& nr,FXint& nc,const FXchar* text,FXint size,FXchar cs='\t',FXchar rs='\n') const; 00216 protected: 00217 enum { 00218 MOUSE_NONE, 00219 MOUSE_SCROLL, 00220 MOUSE_DRAG, 00221 MOUSE_SELECT, 00222 MOUSE_COL_SIZE, 00223 MOUSE_ROW_SIZE 00224 }; 00225 private: 00226 FXTable(const FXTable&); 00227 FXTable& operator=(const FXTable&); 00228 public: 00229 long onPaint(FXObject*,FXSelector,void*); 00230 long onFocusIn(FXObject*,FXSelector,void*); 00231 long onFocusOut(FXObject*,FXSelector,void*); 00232 long onMotion(FXObject*,FXSelector,void*); 00233 long onKeyPress(FXObject*,FXSelector,void*); 00234 long onKeyRelease(FXObject*,FXSelector,void*); 00235 long onLeftBtnPress(FXObject*,FXSelector,void*); 00236 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00237 long onRightBtnPress(FXObject*,FXSelector,void*); 00238 long onRightBtnRelease(FXObject*,FXSelector,void*); 00239 long onUngrabbed(FXObject*,FXSelector,void*); 00240 long onSelectionLost(FXObject*,FXSelector,void*); 00241 long onSelectionGained(FXObject*,FXSelector,void*); 00242 long onSelectionRequest(FXObject*,FXSelector,void* ptr); 00243 long onClipboardLost(FXObject*,FXSelector,void*); 00244 long onClipboardGained(FXObject*,FXSelector,void*); 00245 long onClipboardRequest(FXObject*,FXSelector,void*); 00246 long onAutoScroll(FXObject*,FXSelector,void*); 00247 long onCommand(FXObject*,FXSelector,void*); 00248 long onClicked(FXObject*,FXSelector,void*); 00249 long onDoubleClicked(FXObject*,FXSelector,void*); 00250 long onTripleClicked(FXObject*,FXSelector,void*); 00251 00252 // Visual characteristics 00253 long onCmdHorzGrid(FXObject*,FXSelector,void*); 00254 long onUpdHorzGrid(FXObject*,FXSelector,void*); 00255 long onCmdVertGrid(FXObject*,FXSelector,void*); 00256 long onUpdVertGrid(FXObject*,FXSelector,void*); 00257 00258 // Row/Column manipulations 00259 long onCmdDeleteColumn(FXObject*,FXSelector,void*); 00260 long onUpdDeleteColumn(FXObject*,FXSelector,void*); 00261 long onCmdDeleteRow(FXObject*,FXSelector,void*); 00262 long onUpdDeleteRow(FXObject*,FXSelector,void*); 00263 long onCmdInsertColumn(FXObject*,FXSelector,void*); 00264 long onCmdInsertRow(FXObject*,FXSelector,void*); 00265 00266 // Movement 00267 long onCmdMoveRight(FXObject*,FXSelector,void*); 00268 long onCmdMoveLeft(FXObject*,FXSelector,void*); 00269 long onCmdMoveUp(FXObject*,FXSelector,void*); 00270 long onCmdMoveDown(FXObject*,FXSelector,void*); 00271 long onCmdMoveHome(FXObject*,FXSelector,void*); 00272 long onCmdMoveEnd(FXObject*,FXSelector,void*); 00273 long onCmdMoveTop(FXObject*,FXSelector,void*); 00274 long onCmdMoveBottom(FXObject*,FXSelector,void*); 00275 long onCmdMovePageDown(FXObject*,FXSelector,void*); 00276 long onCmdMovePageUp(FXObject*,FXSelector,void*); 00277 00278 // Mark and extend 00279 long onCmdMark(FXObject*,FXSelector,void*); 00280 long onCmdExtend(FXObject*,FXSelector,void*); 00281 00282 // Changing Selection 00283 long onCmdSelectCell(FXObject*,FXSelector,void*); 00284 long onCmdSelectRow(FXObject*,FXSelector,void*); 00285 long onCmdSelectColumn(FXObject*,FXSelector,void*); 00286 long onCmdSelectRowIndex(FXObject*,FXSelector,void*); 00287 long onCmdSelectColumnIndex(FXObject*,FXSelector,void*); 00288 long onCmdSelectAll(FXObject*,FXSelector,void*); 00289 long onCmdDeselectAll(FXObject*,FXSelector,void*); 00290 00291 // Manipulation Selection 00292 long onCmdCutSel(FXObject*,FXSelector,void*); 00293 long onCmdCopySel(FXObject*,FXSelector,void*); 00294 long onCmdDeleteSel(FXObject*,FXSelector,void*); 00295 long onCmdPasteSel(FXObject*,FXSelector,void*); 00296 long onUpdHaveSelection(FXObject*,FXSelector,void*); 00297 public: 00298 00299 enum { 00300 ID_HORZ_GRID=FXScrollArea::ID_LAST, 00301 ID_VERT_GRID, 00302 ID_DELETE_COLUMN, 00303 ID_DELETE_ROW, 00304 ID_INSERT_COLUMN, 00305 ID_INSERT_ROW, 00306 ID_SELECT_COLUMN_INDEX, 00307 ID_SELECT_ROW_INDEX, 00308 ID_SELECT_COLUMN, 00309 ID_SELECT_ROW, 00310 ID_SELECT_CELL, 00311 ID_SELECT_ALL, 00312 ID_DESELECT_ALL, 00313 ID_MOVE_LEFT, 00314 ID_MOVE_RIGHT, 00315 ID_MOVE_UP, 00316 ID_MOVE_DOWN, 00317 ID_MOVE_HOME, 00318 ID_MOVE_END, 00319 ID_MOVE_TOP, 00320 ID_MOVE_BOTTOM, 00321 ID_MOVE_PAGEDOWN, 00322 ID_MOVE_PAGEUP, 00323 ID_MARK, 00324 ID_EXTEND, 00325 ID_CUT_SEL, 00326 ID_COPY_SEL, 00327 ID_PASTE_SEL, 00328 ID_DELETE_SEL, 00329 ID_LAST 00330 }; 00331 00332 public: 00333 00334 /** 00335 * Construct a new table. 00336 * The table is initially empty, and reports a default size based on 00337 * the scroll areas's scrollbar placement policy. 00338 */ 00339 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); 00340 00341 /// Return default width 00342 virtual FXint getDefaultWidth(); 00343 00344 /// Return default height 00345 virtual FXint getDefaultHeight(); 00346 00347 /// Computes content width 00348 virtual FXint getContentWidth(); 00349 00350 /// Computes content height 00351 virtual FXint getContentHeight(); 00352 00353 /// Create the server-side resources 00354 virtual void create(); 00355 00356 /// Detach the server-side resources 00357 virtual void detach(); 00358 00359 /// Perform layout 00360 virtual void layout(); 00361 00362 /// Mark this window's layout as dirty 00363 virtual void recalc(); 00364 00365 /// Table widget can receive focus 00366 virtual FXbool canFocus() const; 00367 00368 /// Move the focus to this window 00369 virtual void setFocus(); 00370 00371 /// Remove the focus from this window 00372 virtual void killFocus(); 00373 00374 /// Return column header control 00375 FXHeader* getColumnHeader() const { return colHeader; } 00376 00377 /// Return row header control 00378 FXHeader* getRowHeader() const { return rowHeader; } 00379 00380 /// Change visible rows/columns 00381 void setVisibleRows(FXint nvrows); 00382 FXint getVisibleRows() const { return visiblerows; } 00383 void setVisibleColumns(FXint nvcols); 00384 FXint getVisibleColumns() const { return visiblecols; } 00385 00386 /// Show or hide horizontal grid 00387 void showHorzGrid(FXbool on=TRUE); 00388 00389 /// Is horizontal grid shown 00390 FXbool isHorzGridShown() const { return hgrid; } 00391 00392 /// Show or hide vertical grid 00393 void showVertGrid(FXbool on=TRUE); 00394 00395 /// Is vertical grid shown 00396 FXbool isVertGridShown() const { return vgrid; } 00397 00398 /// Get number of rows 00399 FXint getNumRows() const { return nrows; } 00400 00401 /// Get number of columns 00402 FXint getNumColumns() const { return ncols; } 00403 00404 /// Change top cell margin 00405 void setMarginTop(FXint pt); 00406 00407 /// Return top cell margin 00408 FXint getMarginTop() const { return margintop; } 00409 00410 /// Change bottom cell margin 00411 void setMarginBottom(FXint pb); 00412 00413 /// Return bottom cell margin 00414 FXint getMarginBottom() const { return marginbottom; } 00415 00416 /// Change left cell margin 00417 void setMarginLeft(FXint pl); 00418 00419 /// Return left cell margin 00420 FXint getMarginLeft() const { return marginleft; } 00421 00422 /// Change right cell margin 00423 void setMarginRight(FXint pr); 00424 00425 /// Return right cell margin 00426 FXint getMarginRight() const { return marginright; } 00427 00428 /** 00429 * Determine row containing y. 00430 * Returns -1 if y above first row, and nrows if y below last row; 00431 * otherwise, returns row in table containing y. 00432 */ 00433 FXint rowAtY(FXint y) const; 00434 00435 /** 00436 * Determine column containing x. 00437 * Returns -1 if x left of first column, and ncols if x right of last column; 00438 * otherwise, returns columns in table containing x. 00439 */ 00440 FXint colAtX(FXint x) const; 00441 00442 /// Return the item at the given index 00443 FXTableItem *getItem(FXint row,FXint col) const; 00444 00445 /// Replace the item with a [possibly subclassed] item 00446 void setItem(FXint row,FXint col,FXTableItem* item,FXbool notify=FALSE); 00447 00448 /// Set the table size to nr rows and nc columns; all existing items will be removed 00449 virtual void setTableSize(FXint nr,FXint nc,FXbool notify=FALSE); 00450 00451 /// Insert new row 00452 virtual void insertRows(FXint row,FXint nr=1,FXbool notify=FALSE); 00453 00454 /// Insert new column 00455 virtual void insertColumns(FXint col,FXint nc=1,FXbool notify=FALSE); 00456 00457 /// Remove rows of cells 00458 virtual void removeRows(FXint row,FXint nr=1,FXbool notify=FALSE); 00459 00460 /// Remove column of cells 00461 virtual void removeColumns(FXint col,FXint nc=1,FXbool notify=FALSE); 00462 00463 /// Clear single cell 00464 virtual void removeItem(FXint row,FXint col,FXbool notify=FALSE); 00465 00466 /// Clear all cells in the given range 00467 virtual void removeRange(FXint startrow,FXint endrow,FXint startcol,FXint endcol,FXbool notify=FALSE); 00468 00469 /// Remove all items from table 00470 virtual void clearItems(FXbool notify=FALSE); 00471 00472 /// Scroll to make cell at r,c fully visible 00473 void makePositionVisible(FXint r,FXint c); 00474 00475 // Return TRUE if item partially visible 00476 FXbool isItemVisible(FXint r,FXint c) const; 00477 00478 /** 00479 * Change column header height mode to fixed or variable. 00480 * In variable height mode, the column header will size to 00481 * fit the contents in it. In fixed mode, the size is 00482 * explicitly set using setColumnHeaderHeight(). 00483 */ 00484 void setColumnHeaderMode(FXuint hint=LAYOUT_FIX_HEIGHT); 00485 00486 /// Return column header height mode 00487 FXuint getColumnHeaderMode() const; 00488 00489 /** 00490 * Change row header width mode to fixed or variable. 00491 * In variable width mode, the row header will size to 00492 * fit the contents in it. In fixed mode, the size is 00493 * explicitly set using setRowHeaderWidth(). 00494 */ 00495 void setRowHeaderMode(FXuint hint=LAYOUT_FIX_WIDTH); 00496 00497 /// Return row header width mode 00498 FXuint getRowHeaderMode() const; 00499 00500 /// Change column header height 00501 void setColumnHeaderHeight(FXint h); 00502 00503 /// Return column header height 00504 FXint getColumnHeaderHeight() const; 00505 00506 /// Change row header width 00507 void setRowHeaderWidth(FXint w); 00508 00509 /// Return row header width 00510 FXint getRowHeaderWidth() const; 00511 00512 /// Change column width 00513 virtual void setColumnWidth(FXint col,FXint cwidth); 00514 FXint getColumnWidth(FXint col) const; 00515 00516 /// Change row height 00517 virtual void setRowHeight(FXint row,FXint rheight); 00518 FXint getRowHeight(FXint row) const; 00519 00520 /// Change X coordinate of column c 00521 virtual void setColumnX(FXint col,FXint x); 00522 FXint getColumnX(FXint col) const; 00523 00524 /// Change Y coordinate of row r 00525 virtual void setRowY(FXint row,FXint y); 00526 FXint getRowY(FXint row) const; 00527 00528 /// Change default column width 00529 void setDefColumnWidth(FXint cwidth); 00530 FXint getDefColumnWidth() const { return defColWidth; } 00531 00532 /// Change default row height 00533 void setDefRowHeight(FXint rheight); 00534 FXint getDefRowHeight() const { return defRowHeight; } 00535 00536 /// Return minimum row height 00537 FXint getMinRowHeight(FXint r) const; 00538 00539 /// Return minimum column width 00540 FXint getMinColumnWidth(FXint c) const; 00541 00542 /// Change column header 00543 void setColumnText(FXint index,const FXString& text); 00544 00545 /// Return text of column header at index 00546 FXString getColumnText(FXint index) const; 00547 00548 /// Change row header 00549 void setRowText(FXint index,const FXString& text); 00550 00551 /// Return text of row header at index 00552 FXString getRowText(FXint index) const; 00553 00554 /// Modify cell text 00555 void setItemText(FXint r,FXint c,const FXString& text); 00556 FXString getItemText(FXint r,FXint c) const; 00557 00558 /// Modify cell icon 00559 void setItemIcon(FXint r,FXint c,FXIcon* icon); 00560 FXIcon* getItemIcon(FXint r,FXint c) const; 00561 00562 /// Modify cell user-data 00563 void setItemData(FXint r,FXint c,void* ptr); 00564 void* getItemData(FXint r,FXint c) const; 00565 00566 /// Extract cells from given range as text. 00567 void extractText(FXchar*& text,FXint& size,FXint startrow,FXint endrow,FXint startcol,FXint endcol,FXchar cs='\t',FXchar rs='\n') const; 00568 00569 /// Overlay text over given cell range 00570 void overlayText(FXint startrow,FXint endrow,FXint startcol,FXint endcol,const FXchar* text,FXint size,FXchar cs='\t',FXchar rs='\n'); 00571 00572 /// Return TRUE if its a spanning cell 00573 FXbool isItemSpanning(FXint r,FXint c) const; 00574 00575 /// Repaint cells between grid lines sr,er and grid lines sc,ec 00576 void updateRange(FXint sr,FXint er,FXint sc,FXint ec) const; 00577 00578 /// Repaint cell at r,c 00579 void updateItem(FXint r,FXint c) const; 00580 00581 /// Enable item 00582 FXbool enableItem(FXint r,FXint c); 00583 00584 /// Disable item 00585 FXbool disableItem(FXint r,FXint c); 00586 00587 // Is item enabled 00588 FXbool isItemEnabled(FXint r,FXint c) const; 00589 00590 /// Change item justification 00591 void setItemJustify(FXint r,FXint c,FXuint justify); 00592 00593 /// Return item justification 00594 FXuint getItemJustify(FXint r,FXint c) const; 00595 00596 /// Change relative position of icon and text of item 00597 void setItemIconPosition(FXint r,FXint c,FXuint mode); 00598 00599 /// Return relative icon and text position 00600 FXuint getItemIconPosition(FXint r,FXint c) const; 00601 00602 /// Change item border style 00603 void setItemBorders(FXint r,FXint c,FXuint borders); 00604 00605 /// Return item border style 00606 FXuint getItemBorders(FXint r,FXint c) const; 00607 00608 /// Change item background stipple style 00609 void setItemStipple(FXint r,FXint c,FXStipplePattern pat); 00610 00611 /// return item background stipple style 00612 FXStipplePattern getItemStipple(FXint r,FXint c) const; 00613 00614 /// Change current item 00615 virtual void setCurrentItem(FXint r,FXint c,FXbool notify=FALSE); 00616 00617 /// Get row number of current item 00618 FXint getCurrentRow() const { return current.row; } 00619 00620 /// Get column number of current item 00621 FXint getCurrentColumn() const { return current.col; } 00622 00623 // Is item current 00624 FXbool isItemCurrent(FXint r,FXint c) const; 00625 00626 /// Change anchor item 00627 void setAnchorItem(FXint r,FXint c); 00628 00629 /// Get row number of anchor item 00630 FXint getAnchorRow() const { return anchor.row; } 00631 00632 /// Get column number of anchor item 00633 FXint getAnchorColumn() const { return anchor.col; } 00634 00635 /// Get selection start row; returns -1 if no selection 00636 FXint getSelStartRow() const { return selection.fm.row; } 00637 00638 /// Get selection start column; returns -1 if no selection 00639 FXint getSelStartColumn() const { return selection.fm.col; } 00640 00641 /// Get selection end row; returns -1 if no selection 00642 FXint getSelEndRow() const { return selection.to.row; } 00643 00644 /// Get selection end column; returns -1 if no selection 00645 FXint getSelEndColumn() const { return selection.to.col; } 00646 00647 /// Is cell selected 00648 FXbool isItemSelected(FXint r,FXint c) const; 00649 00650 /// Is row of cells selected 00651 FXbool isRowSelected(FXint r) const; 00652 00653 /// Is column selected 00654 FXbool isColumnSelected(FXint c) const; 00655 00656 /// Is anything selected 00657 FXbool isAnythingSelected() const; 00658 00659 /// Select a row 00660 virtual FXbool selectRow(FXint row,FXbool notify=FALSE); 00661 00662 /// Select a column 00663 virtual FXbool selectColumn(FXint col,FXbool notify=FALSE); 00664 00665 /// Select range 00666 virtual FXbool selectRange(FXint startrow,FXint endrow,FXint startcol,FXint endcol,FXbool notify=FALSE); 00667 00668 /// Extend selection 00669 virtual FXbool extendSelection(FXint r,FXint c,FXbool notify=FALSE); 00670 00671 /// Kill selection 00672 virtual FXbool killSelection(FXbool notify=FALSE); 00673 00674 /// Change font 00675 void setFont(FXFont* fnt); 00676 00677 /// Return current font 00678 FXFont* getFont() const { return font; } 00679 00680 /// Obtain colors of various parts 00681 FXColor getTextColor() const { return textColor; } 00682 FXColor getBaseColor() const { return baseColor; } 00683 FXColor getHiliteColor() const { return hiliteColor; } 00684 FXColor getShadowColor() const { return shadowColor; } 00685 FXColor getBorderColor() const { return borderColor; } 00686 FXColor getSelBackColor() const { return selbackColor; } 00687 FXColor getSelTextColor() const { return seltextColor; } 00688 FXColor getGridColor() const { return gridColor; } 00689 FXColor getStippleColor() const { return stippleColor; } 00690 FXColor getCellBorderColor() const { return cellBorderColor; } 00691 00692 /// Change colors of various parts 00693 void setTextColor(FXColor clr); 00694 void setBaseColor(FXColor clr); 00695 void setHiliteColor(FXColor clr); 00696 void setShadowColor(FXColor clr); 00697 void setBorderColor(FXColor clr); 00698 void setSelBackColor(FXColor clr); 00699 void setSelTextColor(FXColor clr); 00700 void setGridColor(FXColor clr); 00701 void setStippleColor(FXColor clr); 00702 void setCellBorderColor(FXColor clr); 00703 00704 /// Change cell background color for even/odd rows/columns 00705 void setCellColor(FXint r,FXint c,FXColor clr); 00706 00707 /// Obtain cell background color for even/odd rows/columns 00708 FXColor getCellColor(FXint r,FXint c) const; 00709 00710 /// Change cell border width 00711 void setCellBorderWidth(FXint borderwidth); 00712 00713 /// Return cell border width 00714 FXint getCellBorderWidth() const { return cellBorderWidth; } 00715 00716 /// Change table style 00717 void setTableStyle(FXuint style); 00718 00719 /// Return table style 00720 FXuint getTableStyle() const; 00721 00722 /// Change help text 00723 void setHelpText(const FXString& text){ help=text; } 00724 FXString getHelpText() const { return help; } 00725 00726 /// Serialize 00727 virtual void save(FXStream& store) const; 00728 virtual void load(FXStream& store); 00729 00730 virtual ~FXTable(); 00731 }; 00732 00733 } 00734 00735 #endif

Copyright © 1997-2004 Jeroen van der Zijp