diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-14 01:18:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-15 22:26:03 +0300 |
commit | 62a466e53cbb49c5338f8ea7f96b46e00d3b0bc4 (patch) | |
tree | 9d69e63c1d2263aadd49afa551c23aff8ec51c2b /src/gui/widgets/dropdown.h | |
parent | 1d290d6a54c2ea6e689446551a8d16025a179177 (diff) | |
download | manaplus-62a466e53cbb49c5338f8ea7f96b46e00d3b0bc4.tar.gz manaplus-62a466e53cbb49c5338f8ea7f96b46e00d3b0bc4.tar.bz2 manaplus-62a466e53cbb49c5338f8ea7f96b46e00d3b0bc4.tar.xz manaplus-62a466e53cbb49c5338f8ea7f96b46e00d3b0bc4.zip |
Add popup list. Replace listbox in dropdown to popup list.
Diffstat (limited to 'src/gui/widgets/dropdown.h')
-rw-r--r-- | src/gui/widgets/dropdown.h | 68 |
1 files changed, 60 insertions, 8 deletions
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index d02b86672..6b3b6503a 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -25,12 +25,25 @@ #include "gui/widgets/widget2.h" -#include <guichan/widgets/dropdown.hpp> +#include "guichan/actionlistener.hpp" +#include "guichan/basiccontainer.hpp" +#include "guichan/focushandler.hpp" +#include "guichan/focuslistener.hpp" +#include "guichan/keylistener.hpp" +#include "guichan/listmodel.hpp" +#include "guichan/mouselistener.hpp" +#include "guichan/selectionlistener.hpp" + +#include "guichan/widgets/listbox.hpp" +#include "guichan/widgets/scrollarea.hpp" #include "localconsts.h" class Image; class ImageRect; +class ListBox; +class PopupList; +class ScrollArea; class Skin; /** @@ -40,7 +53,12 @@ class Skin; * DropDown you must give DropDown an implemented ListModel which represents * your list. */ -class DropDown final : public gcn::DropDown, +class DropDown final : public gcn::ActionListener, + public gcn::BasicContainer, + public gcn::KeyListener, + public gcn::MouseListener, + public gcn::FocusListener, + public gcn::SelectionListener, public Widget2 { public: @@ -70,10 +88,6 @@ class DropDown final : public gcn::DropDown, void drawFrame(gcn::Graphics *graphics) override; - // Inherited from FocusListener - - void focusLost(const gcn::Event& event) override; - // Inherited from KeyListener void keyPressed(gcn::KeyEvent& keyEvent) override; @@ -82,6 +96,10 @@ class DropDown final : public gcn::DropDown, void mousePressed(gcn::MouseEvent& mouseEvent) override; + void mouseReleased(gcn::MouseEvent& mouseEvent) override; + + void mouseDragged(gcn::MouseEvent& mouseEvent) override; + void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) override; void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) override; @@ -90,11 +108,35 @@ class DropDown final : public gcn::DropDown, std::string getSelectedString() const A_WARN_UNUSED; + void valueChanged(const gcn::SelectionEvent& event); + + void updateSelection(); + void adjustHeight(); - void dropDown() override; + void dropDown(); + + void foldUp(); + + void hideDrop(); + + int getSelected() const; - void foldUp() override; + void setSelected(int selected); + + void setListModel(gcn::ListModel *listModel); + + gcn::ListModel *getListModel(); + + void addSelectionListener(SelectionListener* listener); + + void removeSelectionListener(SelectionListener* selectionListener); + + gcn::Rectangle getChildrenArea(); + + void action(const gcn::ActionEvent &actionEvent); + + void distributeValueChangedEvent(); protected: /** @@ -104,11 +146,21 @@ class DropDown final : public gcn::DropDown, */ void drawButton(gcn::Graphics *graphics); + PopupList *mPopup; gcn::Color mShadowColor; gcn::Color mHighlightColor; int mPadding; int mImagePadding; + bool mDroppedDown; + bool mPushed; + int mFoldedUpHeight; +// gcn::FocusHandler mInternalFocusHandler; + bool mIsDragged; + typedef std::list<SelectionListener*> SelectionListenerList; + SelectionListenerList mSelectionListeners; + typedef SelectionListenerList::iterator SelectionListenerIterator; + // Add own Images. static int instances; static Image *buttons[2][2]; |