include/reflex/style.h in reflexion-0.1.12 vs include/reflex/style.h in reflexion-0.1.13

- old
+ new

@@ -3,67 +3,57 @@ #ifndef __REFLEX_STYLE_H__ #define __REFLEX_STYLE_H__ #include <xot/pimpl.h> -#include <reflex/color.h> -#include <reflex/image.h> +#include <rays/color.h> +#include <rays/image.h> +#include <reflex/defs.h> #include <reflex/selector.h> namespace Reflex { - class View; - - class StyleLength { typedef StyleLength This; public: typedef coord Value; - enum Unit {NONE = 0, PIXEL, PERCENT, UNIT_LAST}; + enum Type {NONE = 0, PIXEL, PERCENT, FILL, FIT, TYPE_LAST}; - StyleLength (); + StyleLength (Type type = NONE, Value value = 0); - StyleLength (Value value, Unit unit = PIXEL); - - explicit StyleLength (const char* str); - This copy () const; - void reset (Value value = 0, Unit unit = NONE); + void reset (Type type = NONE, Value value = 0); - void reset (const char* str); - Value value () const; - Unit unit () const; + Type type () const; - String to_s () const; - operator bool () const; bool operator ! () const; friend bool operator == (const This& lhs, const This& rhs); friend bool operator != (const This& lhs, const This& rhs); struct Data; - Xot::PImpl<Data, true> self; + Xot::PSharedImpl<Data> self; };// StyleLength - class Style + class Style : public HasSelector { typedef Style This; public: @@ -72,134 +62,178 @@ { FLOW_NONE = 0, FLOW_RIGHT, FLOW_DOWN, FLOW_LEFT, FLOW_UP, FLOW_LAST }; - typedef Selector:: iterator tag_iterator; - - typedef Selector::const_iterator const_tag_iterator; - Style (const char* name = NULL); ~Style (); - void set_name (const char* name); + void set_name (const char* name); - const char* name () const; + void add_tag (const char* tag); - void add_tag (const char* tag); + void remove_tag (const char* tag); - void remove_tag (const char* tag); + void clear_tags (); - tag_iterator tag_begin (); + void set_selector (const Selector& selector); - const_tag_iterator tag_begin () const; + void set_flow (Flow main, Flow sub = FLOW_NONE); - tag_iterator tag_end (); + void clear_flow (); - const_tag_iterator tag_end () const; + void get_flow (Flow* main, Flow* sub) const; - void set_selector (const Selector& selector); + void set_width (const StyleLength& width); - Selector& selector (); + void clear_width (); - const Selector& selector () const; + const StyleLength& width () const; - void set_flow (Flow main, Flow sub = FLOW_NONE); + void set_height (const StyleLength& height); - void get_flow (Flow* main, Flow* sub) const; + void clear_height (); - void set_width (const StyleLength& width); + const StyleLength& height () const; - void set_height (const StyleLength& height); + void set_left (const StyleLength& left); - const StyleLength& width () const; + void clear_left (); - const StyleLength& height () const; + const StyleLength& left () const; - void set_left (const StyleLength& left); + void set_top (const StyleLength& top); - void set_top (const StyleLength& top); + void clear_top (); - void set_right (const StyleLength& right); + const StyleLength& top () const; - void set_bottom (const StyleLength& bottom); + void set_right (const StyleLength& right); - const StyleLength& left () const; + void clear_right (); - const StyleLength& top () const; + const StyleLength& right () const; - const StyleLength& right () const; + void set_bottom (const StyleLength& bottom); - const StyleLength& bottom () const; + void clear_bottom (); - void set_offset_left (const StyleLength& left); + const StyleLength& bottom () const; - void set_offset_top (const StyleLength& top); + void set_margin_left (const StyleLength& left); - void set_offset_right (const StyleLength& right); + void clear_margin_left (); - void set_offset_bottom (const StyleLength& bottom); + const StyleLength& margin_left () const; - const StyleLength& offset_left () const; + void set_margin_top (const StyleLength& top); - const StyleLength& offset_top () const; + void clear_margin_top (); - const StyleLength& offset_right () const; + const StyleLength& margin_top () const; - const StyleLength& offset_bottom () const; + void set_margin_right (const StyleLength& right); - void set_margin_left (const StyleLength& left); + void clear_margin_right (); - void set_margin_top (const StyleLength& top); + const StyleLength& margin_right () const; - void set_margin_right (const StyleLength& right); + void set_margin_bottom (const StyleLength& bottom); - void set_margin_bottom (const StyleLength& bottom); + void clear_margin_bottom (); - const StyleLength& margin_left () const; + const StyleLength& margin_bottom () const; - const StyleLength& margin_top () const; + void set_padding_left (const StyleLength& left); - const StyleLength& margin_right () const; + void clear_padding_left (); - const StyleLength& margin_bottom () const; + const StyleLength& padding_left () const; - void set_padding_left (const StyleLength& left); + void set_padding_top (const StyleLength& top); - void set_padding_top (const StyleLength& top); + void clear_padding_top (); - void set_padding_right (const StyleLength& right); + const StyleLength& padding_top () const; - void set_padding_bottom (const StyleLength& bottom); + void set_padding_right (const StyleLength& right); - const StyleLength& padding_left () const; + void clear_padding_right (); - const StyleLength& padding_top () const; + const StyleLength& padding_right () const; - const StyleLength& padding_right () const; + void set_padding_bottom (const StyleLength& bottom); - const StyleLength& padding_bottom () const; + void clear_padding_bottom (); - void set_fill (const Color& fill); + const StyleLength& padding_bottom () const; - const Color& fill () const; + void set_center_x (const StyleLength& x); - void set_stroke (const Color& stroke); + void clear_center_x (); - const Color& stroke () const; + const StyleLength& center_x () const; + void set_center_y (const StyleLength& y); + + void clear_center_y (); + + const StyleLength& center_y () const; + + void set_foreground_fill (const Color& fill); + + void clear_foreground_fill (); + + const Color& foreground_fill () const; + + void set_foreground_stroke (const Color& stroke); + + void clear_foreground_stroke (); + + const Color& foreground_stroke () const; + + void set_foreground_stroke_width (coord width); + + void clear_foreground_stroke_width (); + + coord foreground_stroke_width () const; + + void set_background_fill (const Color& fill); + + void clear_background_fill (); + + const Color& background_fill () const; + + void set_background_stroke (const Color& stroke); + + void clear_background_stroke (); + + const Color& background_stroke () const; + + void set_background_stroke_width (coord width); + + void clear_background_stroke_width (); + + coord background_stroke_width () const; + void set_image (const Image& image); + void clear_image (); + const Image& image () const; friend bool operator == (const This& lhs, const This& rhs); friend bool operator != (const This& lhs, const This& rhs); struct Data; - Xot::PImpl<Data, true> self; + Xot::PSharedImpl<Data> self; + + protected: + + virtual SelectorPtr* get_selector_ptr (); };// Style }// Reflex