~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to include/IGUITable.h

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2003-2011 Nikolaus Gebhardt
 
2
// This file is part of the "Irrlicht Engine".
 
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
 
4
 
 
5
#ifndef __I_GUI_TABLE_H_INCLUDED__
 
6
#define __I_GUI_TABLE_H_INCLUDED__
 
7
 
 
8
#include "IGUIElement.h"
 
9
#include "irrTypes.h"
 
10
#include "SColor.h"
 
11
#include "IGUISkin.h"
 
12
 
 
13
namespace irr
 
14
{
 
15
namespace gui
 
16
{
 
17
 
 
18
        //! modes for ordering used when a column header is clicked
 
19
        enum EGUI_COLUMN_ORDERING
 
20
        {
 
21
                //! Do not use ordering
 
22
                EGCO_NONE,
 
23
 
 
24
                //! Send a EGET_TABLE_HEADER_CHANGED message when a column header is clicked.
 
25
                EGCO_CUSTOM,
 
26
 
 
27
                //! Sort it ascending by it's ascii value like: a,b,c,...
 
28
                EGCO_ASCENDING,
 
29
 
 
30
                //! Sort it descending by it's ascii value like: z,x,y,...
 
31
                EGCO_DESCENDING,
 
32
 
 
33
                //! Sort it ascending on first click, descending on next, etc
 
34
                EGCO_FLIP_ASCENDING_DESCENDING,
 
35
 
 
36
                //! Not used as mode, only to get maximum value for this enum
 
37
                EGCO_COUNT
 
38
        };
 
39
 
 
40
        //! Names for EGUI_COLUMN_ORDERING types
 
41
        const c8* const GUIColumnOrderingNames[] =
 
42
        {
 
43
                "none",
 
44
                "custom",
 
45
                "ascend",
 
46
                "descend",
 
47
                "ascend_descend",
 
48
                0,
 
49
        };
 
50
 
 
51
        enum EGUI_ORDERING_MODE
 
52
        {
 
53
                //! No element ordering
 
54
                EGOM_NONE,
 
55
 
 
56
                //! Elements are ordered from the smallest to the largest.
 
57
                EGOM_ASCENDING,
 
58
 
 
59
                //! Elements are ordered from the largest to the smallest.
 
60
                EGOM_DESCENDING,
 
61
 
 
62
                //! this value is not used, it only specifies the amount of default ordering types
 
63
                //! available.
 
64
                EGOM_COUNT
 
65
        };
 
66
 
 
67
        const c8* const GUIOrderingModeNames[] =
 
68
        {
 
69
                "none",
 
70
                "ascending",
 
71
                "descending",
 
72
                0
 
73
        };
 
74
 
 
75
        enum EGUI_TABLE_DRAW_FLAGS
 
76
        {
 
77
                EGTDF_ROWS = 1,
 
78
                EGTDF_COLUMNS = 2,
 
79
                EGTDF_ACTIVE_ROW = 4,
 
80
                EGTDF_COUNT
 
81
        };
 
82
 
 
83
        //! Default list box GUI element.
 
84
        class IGUITable : public IGUIElement
 
85
        {
 
86
        public:
 
87
                //! constructor
 
88
                IGUITable(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
 
89
                        : IGUIElement(EGUIET_TABLE, environment, parent, id, rectangle) {}
 
90
 
 
91
                //! Adds a column
 
92
                /** If columnIndex is outside the current range, do push new colum at the end */
 
93
                virtual void addColumn(const wchar_t* caption, s32 columnIndex=-1) = 0;
 
94
 
 
95
                //! remove a column from the table
 
96
                virtual void removeColumn(u32 columnIndex) = 0;
 
97
 
 
98
                //! Returns the number of columns in the table control
 
99
                virtual s32 getColumnCount() const = 0;
 
100
 
 
101
                //! Makes a column active. This will trigger an ordering process.
 
102
                /** \param idx: The id of the column to make active.
 
103
                \param doOrder: Do also the ordering which depending on mode for active column
 
104
                \return True if successful. */
 
105
                virtual bool setActiveColumn(s32 idx, bool doOrder=false) = 0;
 
106
 
 
107
                //! Returns which header is currently active
 
108
                virtual s32 getActiveColumn() const = 0;
 
109
 
 
110
                //! Returns the ordering used by the currently active column
 
111
                virtual EGUI_ORDERING_MODE getActiveColumnOrdering() const = 0;
 
112
 
 
113
                //! Set the width of a column
 
114
                virtual void setColumnWidth(u32 columnIndex, u32 width) = 0;
 
115
 
 
116
                //! Get the width of a column
 
117
                virtual u32 getColumnWidth(u32 columnIndex) const = 0;
 
118
 
 
119
                //! columns can be resized by drag 'n drop
 
120
                virtual void setResizableColumns(bool resizable) = 0;
 
121
 
 
122
                //! can columns be resized by dran 'n drop?
 
123
                virtual bool hasResizableColumns() const = 0;
 
124
 
 
125
                //! This tells the table control which ordering mode should be used when a column header is clicked.
 
126
                /** \param columnIndex The index of the column header.
 
127
                \param mode: One of the modes defined in EGUI_COLUMN_ORDERING */
 
128
                virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode) = 0;
 
129
 
 
130
                //! Returns which row is currently selected
 
131
                virtual s32 getSelected() const = 0;
 
132
 
 
133
                //! set wich row is currently selected
 
134
                virtual void setSelected( s32 index ) = 0;
 
135
 
 
136
                //! Get amount of rows in the tabcontrol
 
137
                virtual s32 getRowCount() const = 0;
 
138
 
 
139
                //! adds a row to the table
 
140
                /** \param rowIndex Zero based index of rows. The row will be
 
141
                inserted at this position, if a row already exist there, it
 
142
                will be placed after it. If the row is larger than the actual
 
143
                number of row by more than one, it won't be created.  Note that
 
144
                if you create a row that's not at the end, there might be
 
145
                performance issues.
 
146
                \return index of inserted row. */
 
147
                virtual u32 addRow(u32 rowIndex) = 0;
 
148
 
 
149
                //! Remove a row from the table
 
150
                virtual void removeRow(u32 rowIndex) = 0;
 
151
 
 
152
                //! clears the table rows, but keeps the columns intact
 
153
                virtual void clearRows() = 0;
 
154
 
 
155
                //! Swap two row positions.
 
156
                virtual void swapRows(u32 rowIndexA, u32 rowIndexB) = 0;
 
157
 
 
158
                //! This tells the table to start ordering all the rows.
 
159
                /** You need to explicitly tell the table to re order the rows
 
160
                when a new row is added or the cells data is changed. This
 
161
                makes the system more flexible and doesn't make you pay the
 
162
                cost of ordering when adding a lot of rows.
 
163
                \param columnIndex: When set to -1 the active column is used.
 
164
                \param mode Ordering mode of the rows. */
 
165
                virtual void orderRows(s32 columnIndex=-1, EGUI_ORDERING_MODE mode=EGOM_NONE) = 0;
 
166
 
 
167
                //! Set the text of a cell
 
168
                virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text) = 0;
 
169
 
 
170
                //! Set the text of a cell, and set a color of this cell.
 
171
                virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text, video::SColor color) = 0;
 
172
 
 
173
                //! Set the data of a cell
 
174
                virtual void setCellData(u32 rowIndex, u32 columnIndex, void *data) = 0;
 
175
 
 
176
                //! Set the color of a cell text
 
177
                virtual void setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color) = 0;
 
178
 
 
179
                //! Get the text of a cell
 
180
                virtual const wchar_t* getCellText(u32 rowIndex, u32 columnIndex ) const = 0;
 
181
 
 
182
                //! Get the data of a cell
 
183
                virtual void* getCellData(u32 rowIndex, u32 columnIndex ) const = 0;
 
184
 
 
185
                //! clears the table, deletes all items in the table
 
186
                virtual void clear() = 0;
 
187
 
 
188
                //! Set flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout
 
189
                virtual void setDrawFlags(s32 flags) = 0;
 
190
 
 
191
                //! Get the flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout
 
192
                virtual s32 getDrawFlags() const = 0;
 
193
        };
 
194
 
 
195
 
 
196
} // end namespace gui
 
197
} // end namespace irr
 
198
 
 
199
#endif
 
200