guit  0.1
 All Classes Functions Variables Typedefs Enumerations Friends
gformat.hpp
1 //
2 // Data Properties
3 // Guit GUI Toolkit
4 // Copyright © 2019/2020 Eric Lecolinet. All rights reserved.
5 // http://www.telecom-paris.fr/~elc
6 //
7 #ifndef GuitFormat_hpp
8 #define GuitFormat_hpp
9 #include <gprop.hpp>
10 namespace guit {
11 
13 class GFormatValue {
14 public:
15  GFormatValue();
16  bool operator==(GFormatValue const&) const;
17  bool operator!=(GFormatValue const&) const;
18  int8_t precision{}, nbchars{};
19  char fillchar{};
20  /*
21  struct {
22  int8_t underline:1, overline:1, linethrough:1;
23  } decoration;
24  float lineheight;
25  */
26 };
27 
28 bool gconvert(GFormatValue const& from, GFormatValue& to);
29 bool gconvert(GString const& from, GFormatValue& to);
30 bool gconvert(GFormatValue const& from, GString& to);
31 
32 
34 class GFormat : public GVarProp_<GFormatValue> {
35 public:
37 
39  GFormat(GString const& format = "");
40  GFormat(GFormatValue const&);
41  GFormat(GFormat const&);
42  GFormat* clone(bool copy_value) const override;
43 
45  static GType& Type();
46  GType& type() const override {return Type();}
47 
48  void apply(Gadget*, GRender&, Specif) override;
49  void updateGadget(Gadget&) override;
50 };
51 
52 }
53 #endif