X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcontainer.h;h=40fe4dc60d4855e44a890af8a4230b9ab764c3b7;hb=aa9b8db38efb9e97460c76e27cecc4d1591b23e5;hp=4c38675ea85e4f1dbc2cab354feb183c2ef8b780;hpb=56c41b294aa47a38ac3e1be70d4868f260cb4274;p=libs%2Fgltk.git diff --git a/source/container.h b/source/container.h index 4c38675..40fe4dc 100644 --- a/source/container.h +++ b/source/container.h @@ -1,8 +1,8 @@ #ifndef MSP_GLTK_CONTAINER_H_ #define MSP_GLTK_CONTAINER_H_ -#include #include +#include #include #include "mspgltk_api.h" #include "widget.h" @@ -14,7 +14,6 @@ class MSPGLTK_API hierarchy_error: public std::logic_error { public: hierarchy_error(const std::string &); - virtual ~hierarchy_error() throw() { } }; @@ -24,7 +23,7 @@ protected: struct Child: public sigc::trackable { Container &container; - Widget *widget; + Widget *widget = nullptr; Time::TimeDelta time_since_animate; Child(Container &, Widget *); @@ -38,17 +37,17 @@ protected: void rebuild_needed(); }; - std::list children; - Widget *click_focus; - unsigned click_button; - Widget *pointer_focus; - bool pointer_grabbed; - Widget *input_focus; - Widget *saved_input_focus; - Widget *touch_focus; - bool children_rebuild_needed; - - Container(); + std::vector children; + Widget *click_focus = nullptr; + unsigned click_button = 0; + Widget *pointer_focus = nullptr; + bool pointer_grabbed = false; + Widget *input_focus = nullptr; + Widget *saved_input_focus = nullptr; + Widget *touch_focus = nullptr; + bool children_rebuild_needed = false; + + Container() = default; public: virtual ~Container(); @@ -60,9 +59,9 @@ protected: void autosize_child(const Widget &, const Part &, Geometry &) const; void reposition_child(Widget &, const Part &) const; public: - std::list get_children() const; - Widget *get_child_at(int, int) const; - Widget *get_descendant_at(int, int) const; + std::vector get_children() const; + Widget *find_child_at(int, int) const; + Widget *find_descendant_at(int, int) const; void raise(Widget &); protected: @@ -76,28 +75,28 @@ private: void check_animation_interval(); protected: - virtual void rebuild_hierarchy(); + void rebuild_hierarchy() override; public: - virtual void button_press(int, int, unsigned); - virtual void button_release(int, int, unsigned); - virtual void pointer_motion(int, int); + void button_press(int, int, unsigned) override; + void button_release(int, int, unsigned) override; + void pointer_motion(int, int) override; private: Widget *get_pointer_target(int, int, bool) const; public: - virtual void pointer_leave(); - virtual void touch_press(int, int, unsigned); - virtual void touch_release(int, int, unsigned); - virtual void touch_motion(int, int, unsigned); - virtual bool key_press(unsigned, unsigned); - virtual bool key_release(unsigned, unsigned); - virtual bool character(wchar_t); - virtual void focus_in(); - virtual void focus_out(); - virtual bool navigate(Navigation); - virtual void animate(const Time::TimeDelta &); + void pointer_leave() override; + void touch_press(int, int, unsigned) override; + void touch_release(int, int, unsigned) override; + void touch_motion(int, int, unsigned) override; + bool key_press(unsigned, unsigned) override; + bool key_release(unsigned, unsigned) override; + bool character(wchar_t) override; + void focus_in() override; + void focus_out() override; + bool navigate(Navigation) override; + void animate(const Time::TimeDelta &) override; protected: - virtual void on_reparent(); + void on_reparent() override; virtual void on_child_added(Widget &) { } virtual void on_child_removed(Widget &) { } virtual void on_input_focus_changed(Widget *);