Woopsi 1.3
Nintendo DS Gui Framework
libwoopsi/include/scrollinglistbox.h
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 #include "listboxdataitem.h"
00009 #include "gadgetstyle.h"
00010 #include "listboxbase.h"
00011 
00012 namespace WoopsiUI {
00013 
00014     class ScrollbarVertical;
00015 
00021     class ScrollingListBox : public ListBoxBase, public Gadget, public GadgetEventHandler {
00022     public:
00023 
00035         ScrollingListBox(s16 x, s16 y, u16 width, u16 height, GadgetStyle* style = NULL);
00036 
00042         virtual void addOption(const WoopsiString& text, const u32 value);
00043 
00048         virtual void addOption(ListBoxDataItem* option);
00049 
00062         virtual void addOption(const WoopsiString& text, const u32 value, const u16 normalTextColour, const u16 normalBackColour, const u16 selectedTextColour, const u16 selectedBackColour);
00063 
00068         virtual void removeOption(const s32 index);
00069 
00073         virtual void removeAllOptions();
00074 
00081         virtual inline void selectOption(const s32 index) {
00082             _listbox->selectOption(index);
00083         };
00084 
00091         virtual inline void deselectOption(const s32 index) {
00092             _listbox->deselectOption(index);
00093         };
00094 
00100         virtual inline void selectAllOptions() {
00101             _listbox->selectAllOptions();
00102         };
00103 
00108         virtual inline void deselectAllOptions() {
00109             _listbox->deselectAllOptions();
00110         };
00111 
00118         virtual inline const s32 getSelectedIndex() const {
00119             return _listbox->getSelectedIndex();
00120         };
00121 
00128         virtual inline void setSelectedIndex(const s32 index) {
00129             _listbox->setSelectedIndex(index);
00130         };
00131 
00136         virtual inline const ListBoxDataItem* getSelectedOption() const {
00137             return _listbox->getSelectedOption();
00138         };
00139         
00144         virtual inline void setAllowMultipleSelections(const bool allowMultipleSelections) {
00145             _listbox->setAllowMultipleSelections(allowMultipleSelections);
00146         };
00147 
00152         virtual inline const bool allowsMultipleSelections() const {
00153             return _listbox->allowsMultipleSelections();
00154         };
00155 
00159         virtual inline void resizeCanvas() {
00160             _listbox->resizeCanvas();
00161         };
00162 
00167         virtual inline const ListBoxDataItem* getOption(const s32 index) {
00168             return _listbox->getOption(index);
00169         };
00170 
00175         virtual inline const ListBoxDataItem* getOption(const s32 index) const {
00176             return _listbox->getOption(index);
00177         };
00178 
00182         virtual inline void sort() {
00183             _listbox->sort();
00184         };
00185 
00190         virtual inline const s32 getOptionCount() const {
00191             return _listbox->getOptionCount();
00192         };
00193 
00198         virtual inline const u16 getOptionHeight() const {
00199             return _listbox->getOptionHeight();
00200         };
00201 
00206         virtual void handleValueChangeEvent(const GadgetEventArgs& e);
00207 
00212         virtual void handleActionEvent(const GadgetEventArgs& e);
00213 
00218         virtual void handleScrollEvent(const GadgetEventArgs& e);
00219 
00224         virtual void handleClickEvent(const GadgetEventArgs& e);
00225 
00230         virtual void handleDoubleClickEvent(const GadgetEventArgs& e);
00231 
00237         virtual void handleReleaseEvent(const GadgetEventArgs& e);
00238 
00244         virtual void handleReleaseOutsideEvent(const GadgetEventArgs& e);
00245 
00250         virtual void setFont(FontBase* font);
00251 
00257         virtual inline void setSortInsertedItems(const bool sortInsertedItems) { _listbox->setSortInsertedItems(sortInsertedItems); };
00258 
00266         virtual void getPreferredDimensions(Rect& rect) const;
00267 
00268     protected:
00269         ListBox* _listbox;                                  
00270         ScrollbarVertical* _scrollbar;                      
00271         u8 _scrollbarWidth;                                 
00276         void updateScrollbar();
00277 
00284         virtual void drawContents(GraphicsPort* port);
00285 
00291         virtual void onResize(u16 width, u16 height);
00292         
00296         virtual inline ~ScrollingListBox() { };
00297 
00301         inline ScrollingListBox(const ScrollingListBox& scrollingListBox) : Gadget(scrollingListBox) { };
00302     };
00303 }
00304 
00305 #endif
 All Classes Functions Variables Enumerations Enumerator