Changeset View
Changeset View
Standalone View
Standalone View
source/gui/CList.h
Show All 12 Lines | |||||
* | * | ||||
* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | ||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
#ifndef INCLUDED_CLIST | #ifndef INCLUDED_CLIST | ||||
#define INCLUDED_CLIST | #define INCLUDED_CLIST | ||||
#include "gui/CGUIList.h" | |||||
#include "gui/CGUISprite.h" | |||||
#include "gui/IGUIScrollBarOwner.h" | #include "gui/IGUIScrollBarOwner.h" | ||||
#include "gui/IGUITextOwner.h" | #include "gui/IGUITextOwner.h" | ||||
#include <vector> | #include <vector> | ||||
/** | /** | ||||
* Create a list of elements, where one can be selected | * Create a list of elements, where one can be selected | ||||
* by the user. The control will use a pre-processed | * by the user. The control will use a pre-processed | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | protected: | ||||
*/ | */ | ||||
virtual bool HandleAdditionalChildren(const XMBElement& child, CXeromyces* pFile); | virtual bool HandleAdditionalChildren(const XMBElement& child, CXeromyces* pFile); | ||||
// Called every time the auto-scrolling should be checked. | // Called every time the auto-scrolling should be checked. | ||||
void UpdateAutoScroll(); | void UpdateAutoScroll(); | ||||
// Extended drawing interface, this is so that classes built on the this one | // Extended drawing interface, this is so that classes built on the this one | ||||
// can use other sprite names. | // can use other sprite names. | ||||
virtual void DrawList(const int& selected, const CStr& _sprite, const CStr& _sprite_selected, const CStr& _textcolor); | virtual void DrawList(const int& selected, const CGUISpriteInstance& sprite, const CGUISpriteInstance& sprite_selected, const CGUIColor& textcolor); | ||||
// Get the area of the list. This is so that it can easily be changed, like in CDropDown | // Get the area of the list. This is so that it can easily be changed, like in CDropDown | ||||
// where the area is not equal to m_CachedActualSize. | // where the area is not equal to m_CachedActualSize. | ||||
virtual CRect GetListRect() const { return m_CachedActualSize; } | virtual CRect GetListRect() const { return m_CachedActualSize; } | ||||
// Returns whether SetupText() has run since the last message was received | // Returns whether SetupText() has run since the last message was received | ||||
// (and thus whether list items have possibly changed). | // (and thus whether list items have possibly changed). | ||||
virtual bool GetModified() const { return m_Modified; } | virtual bool GetModified() const { return m_Modified; } | ||||
/** | /** | ||||
* List of each element's relative y position. Will be | * List of each element's relative y position. Will be | ||||
* one larger than m_Items, because it will end with the | * one larger than m_Items, because it will end with the | ||||
* bottom of the last element. First element will always | * bottom of the last element. First element will always | ||||
* be zero, but still stored for easy handling. | * be zero, but still stored for easy handling. | ||||
*/ | */ | ||||
std::vector<float> m_ItemsYPositions; | std::vector<float> m_ItemsYPositions; | ||||
virtual int GetHoveredItem(); | virtual int GetHoveredItem(); | ||||
// Settings | |||||
float m_BufferZone; | |||||
CStrW m_Font; | |||||
bool m_ScrollBar; | |||||
CStr m_ScrollBarStyle; | |||||
CStrW m_SoundDisabled; | |||||
CStrW m_SoundSelected; | |||||
CGUISpriteInstance m_Sprite; | |||||
CGUISpriteInstance m_SpriteSelectArea; | |||||
i32 m_CellID; | |||||
EAlign m_TextAlign; | |||||
CGUIColor m_TextColor; | |||||
CGUIColor m_TextColorSelected; | |||||
i32 m_Selected; | |||||
bool m_AutoScroll; | |||||
i32 m_Hovered; | |||||
CGUIList m_List; | |||||
CGUIList m_ListData; | |||||
private: | private: | ||||
// Whether the list's items have been modified since last handling a message. | // Whether the list's items have been modified since last handling a message. | ||||
bool m_Modified; | bool m_Modified; | ||||
// Used for doubleclick registration | // Used for doubleclick registration | ||||
int m_PrevSelectedItem; | int m_PrevSelectedItem; | ||||
// Last time a click on an item was issued | // Last time a click on an item was issued | ||||
double m_LastItemClickTime; | double m_LastItemClickTime; | ||||
}; | }; | ||||
#endif // INCLUDED_CLIST | #endif // INCLUDED_CLIST |
Wildfire Games · Phabricator