guit  0.1
 All Classes Functions Variables Typedefs Enumerations Friends
ggap.hpp
1 //
2 // Gap between gadgets
3 // Guit GUI Toolkit
4 // Copyright © 2020 Eric Lecolinet. All rights reserved.
5 // http://www.telecom-paris.fr/~elc
6 //
7 
8 #ifndef Guit_Gap_hpp
9 #define Guit_Gap_hpp
10 #include <gvarprop.hpp>
11 namespace guit {
12 
13 class GGapValue {
14 public:
15  GGapValue() = default;
16  GGapValue(float main_spacing, float cross_spacing);
17  bool operator==(GGapValue const&) const;
18  bool operator!=(GGapValue const&) const;
19  float mainspacing{1.f}, crossspacing{1.f};
20 };
21 
22 inline bool gconvert(GGapValue const& from, GGapValue& to) {to = from; return true;}
23 bool gconvert(GString const& from, GGapValue& to);
24 bool gconvert(GGapValue const& from, GString& to);
25 
26 
28 class GGap : public GVarProp_<GGapValue> {
29 public:
31 
32  GGap();
33  GGap(GString const& value);
34  GGap(float main_spacing, float croos_spacing);
35  GGap(GGap const& GGap);
36  GGap(GGapValue const&);
37 
38  GGap* clone(bool copy_value) const override;
39 
41  static GType& Type();
42  GType& type() const override {return Type();}
43 
44  void updateGadget(Gadget&) override;
45  void apply(Gadget*, GRender&, Specif) final;
46 };
47 
50 inline GGap& Gap() {return *new GGap();}
51 inline GGap& Gap(GString const& value) {return *new GGap(value);}
53 
54 }
55 #endif