]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/widget.h
Style and comment updates
[libs/gltk.git] / source / widget.h
index 555db7f4c8e2c87cd6d94128e209fc11c5c5a32b..001da84a891f2bb9743f3d3553cff6cee7ddbf03 100644 (file)
@@ -2,10 +2,12 @@
 #define MSP_GLTK_WIDGET_H_
 
 #include <string>
+#include <msp/core/noncopyable.h>
 #include <msp/datafile/objectloader.h>
 #include <msp/gl/renderer.h>
 #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);
@@ -46,20 +49,17 @@ public:
 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;
+       bool rebuild_needed = false;
        Time::TimeDelta anim_interval;
 
-       Widget();
-private:
-       Widget(const Widget &);
-       Widget &operator=(const Widget &);
+       Widget() = default;
 public:
        virtual ~Widget();
 
@@ -119,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); }
@@ -164,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