X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fwidget.h;h=001da84a891f2bb9743f3d3553cff6cee7ddbf03;hb=b59fab7e533ef96d72c92b224d4f24718bc6b0a1;hp=2e8ef7ab09ae8002f4f1037b30dba36d4dc5c40e;hpb=7286d604956ddffcbfa2df6567de866f3d5df3a2;p=libs%2Fgltk.git diff --git a/source/widget.h b/source/widget.h index 2e8ef7a..001da84 100644 --- a/source/widget.h +++ b/source/widget.h @@ -2,10 +2,12 @@ #define MSP_GLTK_WIDGET_H_ #include +#include #include #include #include "geometry.h" #include "inputmethod.h" +#include "mspgltk_api.h" #include "partcache.h" #include "state.h" @@ -20,7 +22,7 @@ class Style; /** Base class for all widgets. */ -class Widget +class MSPGLTK_API Widget: public NonCopyable { friend class Container; @@ -29,6 +31,7 @@ public: { public: Loader(Widget &); + private: void position(int, int); void size(unsigned, unsigned); @@ -41,23 +44,22 @@ public: sigc::signal signal_grab_pointer; sigc::signal signal_ungrab_pointer; sigc::signal signal_request_animation; + sigc::signal signal_rebuild_needed; protected: Geometry geom; std::string style_name; - const Style *style; - State state; - bool visible; - InputType input_type; - Container *parent; + const Style *style = nullptr; + State state = NORMAL; + bool visible = true; + InputType input_type = INPUT_NONE; + Container *parent = nullptr; std::string tooltip; PartCache part_cache; + bool rebuild_needed = false; Time::TimeDelta anim_interval; - Widget(); -private: - Widget(const Widget &); - Widget &operator=(const Widget &); + Widget() = default; public: virtual ~Widget(); @@ -75,6 +77,7 @@ public: const Geometry &get_geometry() const { return geom; } void map_coords_to_ancestor(int &, int &, const Widget &) const; + void map_coords_to_root(int &, int &) const; protected: /** Sets the widget's parent Container. The widget must be unparented when @@ -116,9 +119,6 @@ public: void set_enabled(bool); bool is_enabled() const { return !(state&DISABLED); } - // Deprecated - void set_focusable(bool); - protected: void set_state(State s) { set_state(s, s); } void clear_state(State s) { set_state(s, NORMAL); } @@ -133,6 +133,8 @@ public: const Time::TimeDelta &get_animation_interval() const { return anim_interval; } protected: + void mark_rebuild(); + virtual void rebuild_hierarchy(); void rebuild(); virtual void rebuild_special(const Part &); @@ -159,12 +161,9 @@ public: virtual bool navigate(Navigation) { return false; } virtual void animate(const Time::TimeDelta &) { } protected: - virtual void on_size_change() { on_geometry_change(); } + virtual void on_size_change() { } virtual void on_style_change() { } virtual void on_reparent() { } - - // Deprecated - virtual void on_geometry_change() { } }; } // namespace GLtk