Index: ps/trunk/source/gui/ObjectTypes/COList.h =================================================================== --- ps/trunk/source/gui/ObjectTypes/COList.h (revision 27428) +++ ps/trunk/source/gui/ObjectTypes/COList.h (revision 27429) @@ -1,99 +1,99 @@ /* Copyright (C) 2023 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * 0 A.D. is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with 0 A.D. If not, see . */ #ifndef INCLUDED_COLIST #define INCLUDED_COLIST #include "gui/ObjectTypes/CList.h" #include "gui/SettingTypes/CGUIColor.h" #include /** * Represents a column. */ class COListColumn { public: COListColumn(IGUIObject* owner, const CStr& cid) : m_Id(cid), m_Width(0), m_Heading(owner, "heading_" + cid), m_List(owner, "list_" + cid), - m_Hidden(owner, "hidden_" + cid, false), m_SortOrder(owner, " sort_order_" + cid, -1) + m_Hidden(owner, "hidden_" + cid, false), m_SortOrder(owner, " sort_order_" + cid, 1) {} // Avoid copying the strings. NONCOPYABLE(COListColumn); MOVABLE(COListColumn); CGUIColor m_TextColor; CStr m_Id; float m_Width; CGUISimpleSetting m_Heading; // CGUIString?? CGUISimpleSetting m_List; CGUISimpleSetting m_Hidden; CGUISimpleSetting m_SortOrder; }; /** * Multi-column list. One row can be selected by the user. * Individual cells are clipped if the contained text is too long. * * The list can be sorted dynamically by JS code when a * heading is clicked. * A scroll-bar will appear when needed. */ class COList : public CList { GUI_OBJECT(COList) public: COList(CGUI& pGUI); protected: void SetupText(); void HandleMessage(SGUIMessage& Message); /** * Handle the \ tag. */ virtual bool HandleAdditionalChildren(const XMBData& xmb, const XMBElement& child); virtual void AdditionalChildrenHandled(); virtual void DrawList( CCanvas2D& canvas, const int& selected, const CGUISpriteInstance& sprite, const CGUISpriteInstance& spriteOverlay, const CGUISpriteInstance& spriteSelectarea, const CGUISpriteInstance& spriteSelectAreaOverlay, const CGUIColor& textColor); virtual CRect GetListRect() const; /** * Available columns. */ std::vector m_Columns; CGUISimpleSetting m_SpriteHeading; CGUISimpleSetting m_Sortable; CGUISimpleSetting m_SelectedColumn; CGUISimpleSetting m_SelectedColumnOrder; CGUISimpleSetting m_SpriteAsc; CGUISimpleSetting m_SpriteDesc; CGUISimpleSetting m_SpriteNotSorted; private: static const CStr EventNameSelectionColumnChange; // Width of space available for columns float m_TotalAvailableColumnWidth; float m_HeadingHeight; }; #endif // INCLUDED_COLIST