Irrlicht 3D Engine
IGUITable.h
Go to the documentation of this file.
00001 // Copyright (C) 2003-2012 Nikolaus Gebhardt
00002 // This file is part of the "Irrlicht Engine".
00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
00004 
00005 #ifndef __I_GUI_TABLE_H_INCLUDED__
00006 #define __I_GUI_TABLE_H_INCLUDED__
00007 
00008 #include "IGUIElement.h"
00009 #include "irrTypes.h"
00010 #include "SColor.h"
00011 #include "IGUISkin.h"
00012 
00013 namespace irr
00014 {
00015 namespace gui
00016 {
00017 
00019     enum EGUI_COLUMN_ORDERING
00020     {
00022         EGCO_NONE,
00023 
00025         EGCO_CUSTOM,
00026 
00028         EGCO_ASCENDING,
00029 
00031         EGCO_DESCENDING,
00032 
00034         EGCO_FLIP_ASCENDING_DESCENDING,
00035 
00037         EGCO_COUNT
00038     };
00039 
00041     const c8* const GUIColumnOrderingNames[] =
00042     {
00043         "none",
00044         "custom",
00045         "ascend",
00046         "descend",
00047         "ascend_descend",
00048         0,
00049     };
00050 
00051     enum EGUI_ORDERING_MODE
00052     {
00054         EGOM_NONE,
00055 
00057         EGOM_ASCENDING,
00058 
00060         EGOM_DESCENDING,
00061 
00064         EGOM_COUNT
00065     };
00066 
00067     const c8* const GUIOrderingModeNames[] =
00068     {
00069         "none",
00070         "ascending",
00071         "descending",
00072         0
00073     };
00074 
00075     enum EGUI_TABLE_DRAW_FLAGS
00076     {
00077         EGTDF_ROWS = 1,
00078         EGTDF_COLUMNS = 2,
00079         EGTDF_ACTIVE_ROW = 4,
00080         EGTDF_COUNT
00081     };
00082 
00084 
00089     class IGUITable : public IGUIElement
00090     {
00091     public:
00093         IGUITable(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
00094             : IGUIElement(EGUIET_TABLE, environment, parent, id, rectangle) {}
00095 
00097 
00098         virtual void addColumn(const wchar_t* caption, s32 columnIndex=-1) = 0;
00099 
00101         virtual void removeColumn(u32 columnIndex) = 0;
00102 
00104         virtual s32 getColumnCount() const = 0;
00105 
00107 
00110         virtual bool setActiveColumn(s32 idx, bool doOrder=false) = 0;
00111 
00113         virtual s32 getActiveColumn() const = 0;
00114 
00116         virtual EGUI_ORDERING_MODE getActiveColumnOrdering() const = 0;
00117 
00119         virtual void setColumnWidth(u32 columnIndex, u32 width) = 0;
00120 
00122         virtual u32 getColumnWidth(u32 columnIndex) const = 0;
00123 
00125         virtual void setResizableColumns(bool resizable) = 0;
00126 
00128         virtual bool hasResizableColumns() const = 0;
00129 
00131 
00133         virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode) = 0;
00134 
00136         virtual s32 getSelected() const = 0;
00137 
00139         virtual void setSelected( s32 index ) = 0;
00140 
00142         virtual s32 getRowCount() const = 0;
00143 
00145 
00152         virtual u32 addRow(u32 rowIndex) = 0;
00153 
00155         virtual void removeRow(u32 rowIndex) = 0;
00156 
00158         virtual void clearRows() = 0;
00159 
00161         virtual void swapRows(u32 rowIndexA, u32 rowIndexB) = 0;
00162 
00164 
00170         virtual void orderRows(s32 columnIndex=-1, EGUI_ORDERING_MODE mode=EGOM_NONE) = 0;
00171 
00173         virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text) = 0;
00174 
00176         virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text, video::SColor color) = 0;
00177 
00179         virtual void setCellData(u32 rowIndex, u32 columnIndex, void *data) = 0;
00180 
00182         virtual void setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color) = 0;
00183 
00185         virtual const wchar_t* getCellText(u32 rowIndex, u32 columnIndex ) const = 0;
00186 
00188         virtual void* getCellData(u32 rowIndex, u32 columnIndex ) const = 0;
00189 
00191         virtual void clear() = 0;
00192 
00194         virtual void setDrawFlags(s32 flags) = 0;
00195 
00197         virtual s32 getDrawFlags() const = 0;
00198     };
00199 
00200 
00201 } // end namespace gui
00202 } // end namespace irr
00203 
00204 #endif
00205