X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fwidget.h;h=9b86691e48343344b723af0ad2d90726d82ff6b6;hb=9f38197854e699a6093a906ab43f4238f3cd2388;hp=94ee7f69ff4b3a4d0b00b42ac9f02fa185c3c0cc;hpb=7d8609bec44adcab67b0c1a78d560ef76afded8d;p=libs%2Fgltk.git diff --git a/source/widget.h b/source/widget.h index 94ee7f6..9b86691 100644 --- a/source/widget.h +++ b/source/widget.h @@ -6,6 +6,7 @@ #include #include "geometry.h" #include "inputmethod.h" +#include "mspgltk_api.h" #include "partcache.h" #include "state.h" @@ -20,7 +21,7 @@ class Style; /** Base class for all widgets. */ -class Widget +class MSPGLTK_API Widget { friend class Container; @@ -41,20 +42,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 = 0; + State state = NORMAL; + bool visible = true; + InputType input_type = INPUT_NONE; + Container *parent = 0; std::string tooltip; PartCache part_cache; + bool rebuild_needed = false; Time::TimeDelta anim_interval; - Widget(); + Widget() = default; private: Widget(const Widget &); Widget &operator=(const Widget &); @@ -75,6 +78,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 +120,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 +134,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,7 +162,7 @@ public: virtual bool navigate(Navigation) { return false; } virtual void animate(const Time::TimeDelta &) { } protected: - virtual void on_geometry_change() { } + virtual void on_size_change() { } virtual void on_style_change() { } virtual void on_reparent() { } };