Pyrogenesis  trunk
COList.h
Go to the documentation of this file.
1 /* Copyright (C) 2016 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef INCLUDED_COLIST
18 #define INCLUDED_COLIST
19 
20 #include "GUI.h"
21 #include "CList.h"
22 
23 /**
24  * Represents a column.
25  */
27 {
29  CStr m_Id;
30  float m_Width;
31  CStrW m_Heading;
32 
33 };
34 
35 /**
36  * Multi-column list. One row can be selected by the user.
37  * Individual cells are clipped if the contained text is too long.
38  *
39  * The list can be sorted dynamically by JS code when a
40  * heading is clicked.
41  * A scroll-bar will appear when needed.
42  */
43 class COList : public CList
44 {
46 
47 public:
48  COList();
49 
50 protected:
51  void SetupText();
52  void HandleMessage(SGUIMessage& Message);
53 
54  /**
55  * Handle the <item> tag.
56  */
57  virtual bool HandleAdditionalChildren(const XMBElement& child, CXeromyces* pFile);
58 
59  void DrawList(const int& selected, const CStr& _sprite, const CStr& _sprite_selected, const CStr& _textcolor);
60 
61  virtual CRect GetListRect() const;
62 
63  /**
64  * Available columns.
65  */
66  std::vector<COListColumn> m_Columns;
67 
68 private:
69  // Width of space available for columns
71 };
72 
73 #endif // INCLUDED_COLIST
CStr m_Id
Definition: COList.h:29
CStrW m_Heading
Definition: COList.h:31
Definition: Shapes.h:36
Represents a column.
Definition: COList.h:26
Definition: XeroXMB.h:160
float m_Width
Definition: COList.h:30
CColor m_TextColor
Definition: COList.h:28
Definition: Xeromyces.h:42
Create a list of elements, where one can be selected by the user.
Definition: CList.h:32
std::vector< COListColumn > m_Columns
Available columns.
Definition: COList.h:66
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: GUIbase.h:91
float m_TotalAvailableColumnWidth
Definition: COList.h:70
#define GUI_OBJECT(obj)
Definition: GUIbase.h:48
Multi-column list.
Definition: COList.h:43
Rectangle class used for screen rectangles.
Definition: Shapes.h:73