]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/dropdown.h
Make the List in Dropdown a normal member instead of pointer
[libs/gltk.git] / source / dropdown.h
index 49088e20f2dc8e01e6567f7b6eb69618f1febc0a..ecba9753cb5cace6957f74fa52162887703e202e 100644 (file)
@@ -9,6 +9,7 @@ Distributed under the LGPL
 #define MSP_GLTK_DROPDOWN_H_
 
 #include <sigc++/signal.h>
+#include "list.h"
 #include "widget.h"
 
 namespace Msp {
@@ -28,8 +29,7 @@ public:
        };
 
 private:
-       List *list;
-       std::string text;
+       List list;
        bool dropped;
        bool list_active;
 
@@ -40,15 +40,25 @@ public:
        ~Dropdown();
 
        void append(const std::string &);
+       void insert(unsigned, const std::string &);
+       void remove(unsigned);
+       void clear();
+       unsigned get_n_items() const;
+
+       void set_selected_index(int);
+       const std::string &get_selected() const;
+       int get_selected_index() const;
 
        virtual void button_press(int, int, unsigned);
        virtual void button_release(int, int, unsigned);
        virtual void pointer_motion(int, int);
+
 private:
        virtual const char *get_class() const { return "dropdown"; }
        virtual void render_special(const Part &) const;
 
        virtual void on_geometry_change();
+       void resize_list();
 
        void list_item_selected(unsigned, const std::string &);
 };