aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CGUITable.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CGUITable.h448
1 files changed, 224 insertions, 224 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CGUITable.h b/libraries/irrlicht-1.8/source/Irrlicht/CGUITable.h
index 69cfea5..b2cbf9d 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/CGUITable.h
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CGUITable.h
@@ -1,224 +1,224 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5// 07.10.2005 - Multicolor-Listbox addet by A. Buschhueter (Acki) 5// 07.10.2005 - Multicolor-Listbox addet by A. Buschhueter (Acki)
6// A_Buschhueter@gmx.de 6// A_Buschhueter@gmx.de
7 7
8#ifndef __C_GUI_TABLE_BAR_H_INCLUDED__ 8#ifndef __C_GUI_TABLE_BAR_H_INCLUDED__
9#define __C_GUI_TABLE_BAR_H_INCLUDED__ 9#define __C_GUI_TABLE_BAR_H_INCLUDED__
10 10
11#include "IrrCompileConfig.h" 11#include "IrrCompileConfig.h"
12#ifdef _IRR_COMPILE_WITH_GUI_ 12#ifdef _IRR_COMPILE_WITH_GUI_
13 13
14#include "IGUITable.h" 14#include "IGUITable.h"
15#include "irrArray.h" 15#include "irrArray.h"
16 16
17namespace irr 17namespace irr
18{ 18{
19namespace gui 19namespace gui
20{ 20{
21 21
22 class IGUIFont; 22 class IGUIFont;
23 class IGUIScrollBar; 23 class IGUIScrollBar;
24 24
25 class CGUITable : public IGUITable 25 class CGUITable : public IGUITable
26 { 26 {
27 public: 27 public:
28 //! constructor 28 //! constructor
29 CGUITable(IGUIEnvironment* environment, IGUIElement* parent, 29 CGUITable(IGUIEnvironment* environment, IGUIElement* parent,
30 s32 id, const core::rect<s32>& rectangle, bool clip=true, 30 s32 id, const core::rect<s32>& rectangle, bool clip=true,
31 bool drawBack=false, bool moveOverSelect=true); 31 bool drawBack=false, bool moveOverSelect=true);
32 32
33 //! destructor 33 //! destructor
34 ~CGUITable(); 34 ~CGUITable();
35 35
36 //! Adds a column 36 //! Adds a column
37 //! If columnIndex is outside the current range, do push new colum at the end 37 //! If columnIndex is outside the current range, do push new colum at the end
38 virtual void addColumn(const wchar_t* caption, s32 columnIndex=-1); 38 virtual void addColumn(const wchar_t* caption, s32 columnIndex=-1);
39 39
40 //! remove a column from the table 40 //! remove a column from the table
41 virtual void removeColumn(u32 columnIndex); 41 virtual void removeColumn(u32 columnIndex);
42 42
43 //! Returns the number of columns in the table control 43 //! Returns the number of columns in the table control
44 virtual s32 getColumnCount() const; 44 virtual s32 getColumnCount() const;
45 45
46 //! Makes a column active. This will trigger an ordering process. 46 //! Makes a column active. This will trigger an ordering process.
47 /** \param idx: The id of the column to make active. 47 /** \param idx: The id of the column to make active.
48 \return True if successful. */ 48 \return True if successful. */
49 virtual bool setActiveColumn(s32 columnIndex, bool doOrder=false); 49 virtual bool setActiveColumn(s32 columnIndex, bool doOrder=false);
50 50
51 //! Returns which header is currently active 51 //! Returns which header is currently active
52 virtual s32 getActiveColumn() const; 52 virtual s32 getActiveColumn() const;
53 53
54 //! Returns the ordering used by the currently active column 54 //! Returns the ordering used by the currently active column
55 virtual EGUI_ORDERING_MODE getActiveColumnOrdering() const; 55 virtual EGUI_ORDERING_MODE getActiveColumnOrdering() const;
56 56
57 //! set a column width 57 //! set a column width
58 virtual void setColumnWidth(u32 columnIndex, u32 width); 58 virtual void setColumnWidth(u32 columnIndex, u32 width);
59 59
60 //! Get the width of a column 60 //! Get the width of a column
61 virtual u32 getColumnWidth(u32 columnIndex) const; 61 virtual u32 getColumnWidth(u32 columnIndex) const;
62 62
63 //! columns can be resized by drag 'n drop 63 //! columns can be resized by drag 'n drop
64 virtual void setResizableColumns(bool resizable); 64 virtual void setResizableColumns(bool resizable);
65 65
66 //! can columns be resized by dran 'n drop? 66 //! can columns be resized by dran 'n drop?
67 virtual bool hasResizableColumns() const; 67 virtual bool hasResizableColumns() const;
68 68
69 //! This tells the table control which ordering mode should be used when 69 //! This tells the table control which ordering mode should be used when
70 //! a column header is clicked. 70 //! a column header is clicked.
71 /** \param columnIndex: The index of the column header. 71 /** \param columnIndex: The index of the column header.
72 \param state: If true, a EGET_TABLE_HEADER_CHANGED message will be sent and you can order the table data as you whish.*/ 72 \param state: If true, a EGET_TABLE_HEADER_CHANGED message will be sent and you can order the table data as you whish.*/
73 //! \param mode: One of the modes defined in EGUI_COLUMN_ORDERING 73 //! \param mode: One of the modes defined in EGUI_COLUMN_ORDERING
74 virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode); 74 virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode);
75 75
76 //! Returns which row is currently selected 76 //! Returns which row is currently selected
77 virtual s32 getSelected() const; 77 virtual s32 getSelected() const;
78 78
79 //! set wich row is currently selected 79 //! set wich row is currently selected
80 virtual void setSelected( s32 index ); 80 virtual void setSelected( s32 index );
81 81
82 //! Returns amount of rows in the tabcontrol 82 //! Returns amount of rows in the tabcontrol
83 virtual s32 getRowCount() const; 83 virtual s32 getRowCount() const;
84 84
85 //! adds a row to the table 85 //! adds a row to the table
86 /** \param rowIndex: zero based index of rows. The row will be 86 /** \param rowIndex: zero based index of rows. The row will be
87 inserted at this position. If a row already exists 87 inserted at this position. If a row already exists
88 there, it will be placed after it. If the row is larger 88 there, it will be placed after it. If the row is larger
89 than the actual number of rows by more than one, it 89 than the actual number of rows by more than one, it
90 won't be created. Note that if you create a row that is 90 won't be created. Note that if you create a row that is
91 not at the end, there might be performance issues*/ 91 not at the end, there might be performance issues*/
92 virtual u32 addRow(u32 rowIndex); 92 virtual u32 addRow(u32 rowIndex);
93 93
94 //! Remove a row from the table 94 //! Remove a row from the table
95 virtual void removeRow(u32 rowIndex); 95 virtual void removeRow(u32 rowIndex);
96 96
97 //! clear the table rows, but keep the columns intact 97 //! clear the table rows, but keep the columns intact
98 virtual void clearRows(); 98 virtual void clearRows();
99 99
100 //! Swap two row positions. This is useful for a custom ordering algo. 100 //! Swap two row positions. This is useful for a custom ordering algo.
101 virtual void swapRows(u32 rowIndexA, u32 rowIndexB); 101 virtual void swapRows(u32 rowIndexA, u32 rowIndexB);
102 102
103 //! This tells the table to start ordering all the rows. You 103 //! This tells the table to start ordering all the rows. You
104 //! need to explicitly tell the table to reorder the rows when 104 //! need to explicitly tell the table to reorder the rows when
105 //! a new row is added or the cells data is changed. This makes 105 //! a new row is added or the cells data is changed. This makes
106 //! the system more flexible and doesn't make you pay the cost 106 //! the system more flexible and doesn't make you pay the cost
107 //! of ordering when adding a lot of rows. 107 //! of ordering when adding a lot of rows.
108 //! \param columnIndex: When set to -1 the active column is used. 108 //! \param columnIndex: When set to -1 the active column is used.
109 virtual void orderRows(s32 columnIndex=-1, EGUI_ORDERING_MODE mode=EGOM_NONE); 109 virtual void orderRows(s32 columnIndex=-1, EGUI_ORDERING_MODE mode=EGOM_NONE);
110 110
111 111
112 //! Set the text of a cell 112 //! Set the text of a cell
113 virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text); 113 virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text);
114 114
115 //! Set the text of a cell, and set a color of this cell. 115 //! Set the text of a cell, and set a color of this cell.
116 virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text, video::SColor color); 116 virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text, video::SColor color);
117 117
118 //! Set the data of a cell 118 //! Set the data of a cell
119 //! data will not be serialized. 119 //! data will not be serialized.
120 virtual void setCellData(u32 rowIndex, u32 columnIndex, void *data); 120 virtual void setCellData(u32 rowIndex, u32 columnIndex, void *data);
121 121
122 //! Set the color of a cell text 122 //! Set the color of a cell text
123 virtual void setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color); 123 virtual void setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color);
124 124
125 //! Get the text of a cell 125 //! Get the text of a cell
126 virtual const wchar_t* getCellText(u32 rowIndex, u32 columnIndex ) const; 126 virtual const wchar_t* getCellText(u32 rowIndex, u32 columnIndex ) const;
127 127
128 //! Get the data of a cell 128 //! Get the data of a cell
129 virtual void* getCellData(u32 rowIndex, u32 columnIndex ) const; 129 virtual void* getCellData(u32 rowIndex, u32 columnIndex ) const;
130 130
131 //! clears the table, deletes all items in the table 131 //! clears the table, deletes all items in the table
132 virtual void clear(); 132 virtual void clear();
133 133
134 //! called if an event happened. 134 //! called if an event happened.
135 virtual bool OnEvent(const SEvent &event); 135 virtual bool OnEvent(const SEvent &event);
136 136
137 //! draws the element and its children 137 //! draws the element and its children
138 virtual void draw(); 138 virtual void draw();
139 139
140 //! Set flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout 140 //! Set flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout
141 virtual void setDrawFlags(s32 flags); 141 virtual void setDrawFlags(s32 flags);
142 142
143 //! Get the flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout 143 //! Get the flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout
144 virtual s32 getDrawFlags() const; 144 virtual s32 getDrawFlags() const;
145 145
146 //! Writes attributes of the object. 146 //! Writes attributes of the object.
147 //! Implement this to expose the attributes of your scene node animator for 147 //! Implement this to expose the attributes of your scene node animator for
148 //! scripting languages, editors, debuggers or xml serialization purposes. 148 //! scripting languages, editors, debuggers or xml serialization purposes.
149 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; 149 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
150 150
151 //! Reads attributes of the object. 151 //! Reads attributes of the object.
152 //! Implement this to set the attributes of your scene node animator for 152 //! Implement this to set the attributes of your scene node animator for
153 //! scripting languages, editors, debuggers or xml deserialization purposes. 153 //! scripting languages, editors, debuggers or xml deserialization purposes.
154 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); 154 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
155 155
156 protected: 156 protected:
157 virtual void refreshControls(); 157 virtual void refreshControls();
158 virtual void checkScrollbars(); 158 virtual void checkScrollbars();
159 159
160 private: 160 private:
161 161
162 struct Cell 162 struct Cell
163 { 163 {
164 Cell() : IsOverrideColor(false), Data(0) {} 164 Cell() : IsOverrideColor(false), Data(0) {}
165 core::stringw Text; 165 core::stringw Text;
166 core::stringw BrokenText; 166 core::stringw BrokenText;
167 bool IsOverrideColor; 167 bool IsOverrideColor;
168 video::SColor Color; 168 video::SColor Color;
169 void *Data; 169 void *Data;
170 }; 170 };
171 171
172 struct Row 172 struct Row
173 { 173 {
174 Row() {} 174 Row() {}
175 core::array<Cell> Items; 175 core::array<Cell> Items;
176 }; 176 };
177 177
178 struct Column 178 struct Column
179 { 179 {
180 Column() : Width(0), OrderingMode(EGCO_NONE) {} 180 Column() : Width(0), OrderingMode(EGCO_NONE) {}
181 core::stringw Name; 181 core::stringw Name;
182 u32 Width; 182 u32 Width;
183 EGUI_COLUMN_ORDERING OrderingMode; 183 EGUI_COLUMN_ORDERING OrderingMode;
184 }; 184 };
185 185
186 void breakText(const core::stringw &text, core::stringw & brokenText, u32 cellWidth); 186 void breakText(const core::stringw &text, core::stringw & brokenText, u32 cellWidth);
187 void selectNew(s32 ypos, bool onlyHover=false); 187 void selectNew(s32 ypos, bool onlyHover=false);
188 bool selectColumnHeader(s32 xpos, s32 ypos); 188 bool selectColumnHeader(s32 xpos, s32 ypos);
189 bool dragColumnStart(s32 xpos, s32 ypos); 189 bool dragColumnStart(s32 xpos, s32 ypos);
190 bool dragColumnUpdate(s32 xpos); 190 bool dragColumnUpdate(s32 xpos);
191 void recalculateHeights(); 191 void recalculateHeights();
192 void recalculateWidths(); 192 void recalculateWidths();
193 193
194 core::array< Column > Columns; 194 core::array< Column > Columns;
195 core::array< Row > Rows; 195 core::array< Row > Rows;
196 gui::IGUIFont* Font; 196 gui::IGUIFont* Font;
197 gui::IGUIScrollBar* VerticalScrollBar; 197 gui::IGUIScrollBar* VerticalScrollBar;
198 gui::IGUIScrollBar* HorizontalScrollBar; 198 gui::IGUIScrollBar* HorizontalScrollBar;
199 bool Clip; 199 bool Clip;
200 bool DrawBack; 200 bool DrawBack;
201 bool MoveOverSelect; 201 bool MoveOverSelect;
202 bool Selecting; 202 bool Selecting;
203 s32 CurrentResizedColumn; 203 s32 CurrentResizedColumn;
204 s32 ResizeStart; 204 s32 ResizeStart;
205 bool ResizableColumns; 205 bool ResizableColumns;
206 206
207 s32 ItemHeight; 207 s32 ItemHeight;
208 s32 TotalItemHeight; 208 s32 TotalItemHeight;
209 s32 TotalItemWidth; 209 s32 TotalItemWidth;
210 s32 Selected; 210 s32 Selected;
211 s32 CellHeightPadding; 211 s32 CellHeightPadding;
212 s32 CellWidthPadding; 212 s32 CellWidthPadding;
213 s32 ActiveTab; 213 s32 ActiveTab;
214 EGUI_ORDERING_MODE CurrentOrdering; 214 EGUI_ORDERING_MODE CurrentOrdering;
215 s32 DrawFlags; 215 s32 DrawFlags;
216 }; 216 };
217 217
218} // end namespace gui 218} // end namespace gui
219} // end namespace irr 219} // end namespace irr
220 220
221#endif // _IRR_COMPILE_WITH_GUI_ 221#endif // _IRR_COMPILE_WITH_GUI_
222 222
223#endif 223#endif
224 224