00001 #ifndef _SCROLLING_LISTBOX_H_
00002 #define _SCROLLING_LISTBOX_H_
00003
00004 #include "gadget.h"
00005 #include "listbox.h"
00006 #include "gadgeteventhandler.h"
00007 #include "listdata.h"
00008
00009 namespace WoopsiUI {
00010
00011 class ScrollbarVertical;
00012
00018 class ScrollingListBox : public Gadget, public GadgetEventHandler {
00019 public:
00020
00029 ScrollingListBox(s16 x, s16 y, u16 width, u16 height, FontBase* font = NULL);
00030
00036 virtual void addOption(const char* text, const u32 value);
00037
00047 virtual void addOption(const char* text, const u32 value, const u16 normalTextColour, const u16 normalBackColour, const u16 selectedTextColour, const u16 selectedBackColour);
00048
00053 virtual void removeOption(const s32 index);
00054
00058 virtual void removeAllOptions();
00059
00065 virtual inline void selectOption(const s32 index) {
00066 _listbox->selectOption(index);
00067 };
00068
00074 virtual inline void deselectOption(const s32 index) {
00075 _listbox->deselectOption(index);
00076 };
00077
00082 virtual inline void selectAllOptions() {
00083 _listbox->selectAllOptions();
00084 };
00085
00090 virtual inline void deselectAllOptions() {
00091 _listbox->deselectAllOptions();
00092 };
00093
00098 virtual void draw(Rect clipRect);
00099
00105 virtual inline const s32 getSelectedIndex() const {
00106 return _listbox->getSelectedIndex();
00107 };
00108
00115 virtual inline void setSelectedIndex(const s32 index) {
00116 _listbox->setSelectedIndex(index);
00117 };
00118
00123 virtual inline const ListData::ListDataItem* getSelectedOption() const {
00124 return _listbox->getSelectedOption();
00125 };
00126
00132 virtual inline void setAllowMultipleSelections(const bool allowMultipleSelections) {
00133 _listbox->setAllowMultipleSelections(allowMultipleSelections);
00134 };
00135
00140 virtual inline void resizeCanvas() {
00141 _listbox->resizeCanvas();
00142 }
00143
00148 virtual inline const ListData::ListDataItem* getOption(const s32 index) const {
00149 return _listbox->getOption(index);
00150 };
00151
00155 virtual inline void sort() {
00156 _listbox->sort();
00157 };
00158
00163 virtual inline const s32 getOptionCount() const {
00164 return _listbox->getOptionCount();
00165 };
00166
00171 virtual inline const u16 getOptionHeight() const {
00172 return _listbox->getOptionHeight();
00173 };
00174
00179 virtual void handleValueChangeEvent(const GadgetEventArgs& e);
00180
00185 virtual void handleScrollEvent(const GadgetEventArgs& e);
00186
00191 virtual void handleDoubleClickEvent(const GadgetEventArgs& e);
00192
00199 virtual bool resize(u16 width, u16 height);
00200
00205 virtual void setFont(FontBase* font);
00206
00211 inline void setOutlineType(const OutlineType outline) {
00212 _listbox->setOutlineType(outline);
00213 };
00214
00219 virtual inline void setSortInsertedItems(const bool sortInsertedItems) { _listbox->setSortInsertedItems(sortInsertedItems); };
00220
00221 protected:
00222 ListBox* _listbox;
00223 ScrollbarVertical* _scrollbar;
00224 u8 _scrollbarWidth;
00229 virtual inline ~ScrollingListBox() { };
00230
00234 inline ScrollingListBox(const ScrollingListBox& scrollingListBox) : Gadget(scrollingListBox) { };
00235 };
00236 }
00237
00238 #endif