Ticket #1558: dropdown-list.patch
File dropdown-list.patch, 2.5 KB (added by , 12 years ago) |
---|
-
source/gui/CList.cpp
31 31 //------------------------------------------------------------------- 32 32 // Constructor / Destructor 33 33 //------------------------------------------------------------------- 34 CList::CList() 34 CList::CList() : 35 m_Modified(false) 35 36 { 36 37 // Add sprite_disabled! TODO 37 38 … … 74 75 if (!GetGUI()) 75 76 return; 76 77 78 m_Modified = true; 77 79 CGUIList *pList; 78 80 GUI<CGUIList>::GetSettingPointer(this, "list", pList); 79 81 … … 151 153 IGUIScrollBarOwner::HandleMessage(Message); 152 154 //IGUITextOwner::HandleMessage(Message); <== placed it after the switch instead! 153 155 156 m_Modified = false; 154 157 switch (Message.type) 155 158 { 156 159 case GUIM_SETTINGS_UPDATED: -
source/gui/CList.h
124 124 void DrawList(const int &selected, const CStr& _sprite, 125 125 const CStr& _sprite_selected, const CStr& _textcolor); 126 126 127 // Get the area of the list. This is so that i can easily be changed, like in CDropDown127 // Get the area of the list. This is so that it can easily be changed, like in CDropDown 128 128 // where the area is not equal to m_CachedActualSize. 129 129 virtual CRect GetListRect() const { return m_CachedActualSize; } 130 130 131 // Returns whether SetupText() has run since the last message was received 132 // (and thus whether list items have possibly changed). 133 virtual bool GetModified() const { return m_Modified; } 134 131 135 // List of items. 132 136 //CGUIList m_List; 133 137 … … 138 142 * be zero, but still stored for easy handling. 139 143 */ 140 144 std::vector<float> m_ItemsYPositions; 145 146 private: 147 // Whether the list's items have been modified since last handling a message. 148 bool m_Modified; 141 149 }; 142 150 143 151 #endif -
source/gui/CDropDown.cpp
192 192 193 193 // Important that this is after, so that overshadowed implementations aren't processed 194 194 CList::HandleMessage(Message); 195 196 // As HandleMessage functions return void, we need to manually verify 197 // whether the child list's items were modified. 198 if (CList::GetModified()) 199 SetupText(); 195 200 } 196 201 197 202 InReaction CDropDown::ManuallyHandleEvent(const SDL_Event_* ev)