guit  0.1
 All Classes Functions Variables Typedefs Enumerations Friends
gadgetstyle.hpp
1 //
2 // GadgetStyle
3 // Guit GUI Toolkit
4 // Copyright © 2020 Eric Lecolinet. All rights reserved.
5 // http://www.telecom-paris.fr/~elc
6 //
7 
8 #ifndef Guit_GadgetStyle_hpp
9 #define Guit_GadgetStyle_hpp
10 #include <gprop.hpp>
11 namespace guit {
12 
13 class GStyle;
14 
17 class GadgetStyle : public GObject {
18 public:
19  ~GadgetStyle();
20 
21  static bool initStyle(Gadget&, GString const& spec, GString& title);
22  void realize(Gadget const&);
23 
24  GProp* findProp(Gadget const&, GPropType&) ;
25 
26  template <class T> T* findProp(Gadget const& g) {
27  return static_cast<T*>(findProp(g, T::Type()));
28  }
29 
30  // either the 1st or 2nd argument must be non-nul.
31  static bool parseProps(Gadget*, GPropList*, GString const& style,
32  GString const& delim);
33 
34  GString typeName() const override;
35 
36 private:
37  friend class GStyle;
38  friend class GRender;
39  GadgetStyle(GString const& ids);
40  bool realized_{};
41  uint16_t size_{};
42  union {
43  GString* names_;
44  GId* ids_; // null or 0 ended
45  };
46 };
47 
48 }
49 #endif