Woopsi 1.0
GUI Framework for Nintendo DS Homebrew

requester.h

00001 #ifndef _REQUESTER_H_
00002 #define _REQUESTER_H_
00003 
00004 #include "amigawindow.h"
00005 #include "scrollinglistbox.h"
00006 #include "listdata.h"
00007 #include "gadgetstyle.h"
00008 
00009 namespace WoopsiUI {
00010 
00011         class Button;
00012 
00021         class Requester : public AmigaWindow {
00022         public:
00035                 Requester(s16 x, s16 y, u16 width, u16 height, const WoopsiString& title, GadgetStyle* style = NULL);
00036 
00041                 virtual void handleReleaseEvent(const GadgetEventArgs& e);
00042 
00047                 virtual void handleDoubleClickEvent(const GadgetEventArgs& e);
00048 
00054                 virtual inline void addOption(const WoopsiString& text, const u32 value) {
00055                         _listbox->addOption(text, value);
00056                 };
00057 
00067                 virtual inline void addOption(const WoopsiString& text, const u32 value, const u16 normalTextColour, const u16 normalBackColour, const u16 selectedTextColour, const u16 selectedBackColour) {
00068                         _listbox->addOption(text, value, normalTextColour, normalBackColour, selectedTextColour, selectedBackColour);
00069                 };
00070 
00075                 virtual inline void removeOption(const s32 index) {
00076                         _listbox->removeOption(index);
00077                 };
00078 
00082                 virtual inline void removeAllOptions() {
00083                         _listbox->removeAllOptions();
00084                 };
00085 
00091                 virtual const s32 getSelectedIndex() const {
00092                         return _listbox->getSelectedIndex();
00093                 };
00094 
00099                 virtual inline const ListBoxDataItem* getSelectedOption() const {
00100                         return _listbox->getSelectedOption();
00101                 };
00102 
00107                 virtual inline void setAllowMultipleSelections(const bool allowMultipleSelections) {
00108                         _listbox->setAllowMultipleSelections(allowMultipleSelections);
00109                 };
00110 
00115                 virtual inline const ListBoxDataItem* getOption(const s32 index) const {
00116                         return _listbox->getOption(index);
00117                 };
00118 
00122                 virtual inline void sort() {
00123                         _listbox->sort();
00124                 };
00125 
00130                 virtual inline const s32 getOptionCount() const {
00131                         return _listbox->getOptionCount();
00132                 };
00133 
00134         protected:
00135                 Button* _okButton;                                      
00136                 Button* _cancelButton;                          
00137                 ScrollingListBox* _listbox;                     
00144                 virtual void onResize(u16 width, u16 height);
00145                 
00149                 virtual inline ~Requester() { };
00150 
00154                 inline Requester(const Requester& requester) : AmigaWindow(requester) { };
00155         };
00156 }
00157 
00158 #endif