#include <msp/gl/renderer.h>
#include "geometry.h"
#include "inputmethod.h"
+#include "mspgltk_api.h"
#include "partcache.h"
#include "state.h"
/**
Base class for all widgets.
*/
-class Widget
+class MSPGLTK_API Widget
{
friend class Container;
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;
+ bool rebuild_needed = false;
Time::TimeDelta anim_interval;
- Widget();
+ Widget() = default;
private:
Widget(const Widget &);
Widget &operator=(const Widget &);
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
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); }
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