OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
list.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_COMPONENTS_WIDGETS_LIST_HPP
2 #define OPENMW_COMPONENTS_WIDGETS_LIST_HPP
3 
4 #include <MyGUI_ScrollView.h>
5 
6 namespace Gui
7 {
12  class MWList : public MyGUI::Widget
13  {
14  MYGUI_RTTI_DERIVED(MWList)
15  public:
16  MWList();
17 
18  typedef MyGUI::delegates::CMultiDelegate2<const std::string&, int> EventHandle_StringInt;
19  typedef MyGUI::delegates::CMultiDelegate1<MyGUI::Widget*> EventHandle_Widget;
20 
26 
32 
33 
37  void adjustSize();
38 
39  void addItem(const std::string& name);
40  void addSeparator();
41  void removeItem(const std::string& name);
42  unsigned int getItemCount();
43  std::string getItemNameAt(unsigned int at);
44  void clear();
45 
46  MyGUI::Button* getItemWidget(const std::string& name);
48 
49  void scrollToTop();
50 
51  virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
52 
53  protected:
54  void initialiseOverride();
55 
56  void redraw(bool scrollbarShown = false);
57 
58  void onMouseWheelMoved(MyGUI::Widget* _sender, int _rel);
59  void onItemSelected(MyGUI::Widget* _sender);
60 
61  private:
62  MyGUI::ScrollView* mScrollView;
63  MyGUI::Widget* mClient;
64  std::string mListItemSkin;
65 
66  std::vector<std::string> mItems;
67 
68  int mItemHeight; // height of all items
69  };
70 }
71 
72 #endif
MyGUI::Widget * mClient
Definition: list.hpp:63
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
Definition: list.cpp:108
std::string mListItemSkin
Definition: list.hpp:64
a very simple list widget that supports word-wrapping entries
Definition: list.hpp:12
MyGUI::delegates::CMultiDelegate2< const std::string &, int > EventHandle_StringInt
Definition: list.hpp:18
std::vector< std::string > mItems
Definition: list.hpp:66
void redraw(bool scrollbarShown=false)
Definition: list.cpp:46
void clear()
Definition: list.cpp:133
MyGUI::Button * getItemWidget(const std::string &name)
get widget for an item name, useful to set up tooltip
Definition: list.cpp:155
void adjustSize()
Definition: list.cpp:41
void scrollToTop()
Definition: list.cpp:160
MyGUI::delegates::CMultiDelegate1< MyGUI::Widget * > EventHandle_Widget
Definition: list.hpp:19
void removeItem(const std::string &name)
Definition: list.cpp:127
void onMouseWheelMoved(MyGUI::Widget *_sender, int _rel)
Definition: list.cpp:138
void onItemSelected(MyGUI::Widget *_sender)
Definition: list.cpp:147
MWList()
Definition: list.cpp:11
void addItem(const std::string &name)
Definition: list.cpp:31
std::string getItemNameAt(unsigned int at)
Definition: list.cpp:121
EventHandle_Widget eventWidgetSelected
Definition: list.hpp:31
void addSeparator()
add a seperator between the current and the next item.
Definition: list.cpp:36
void initialiseOverride()
Definition: list.cpp:18
int mItemHeight
Definition: list.hpp:68
EventHandle_StringInt eventItemSelected
Definition: list.hpp:25
MyGUI::ScrollView * mScrollView
Definition: list.hpp:62
unsigned int getItemCount()
Definition: list.cpp:116
const char * name
Definition: crashcatcher.cpp:59