guit  0.1
 All Classes Functions Variables Typedefs Enumerations Friends
gchart.hpp
1 //
2 // Charts.
3 // guit GUI Toolkit
4 // Copyright © 2020 Eric Lecolinet. All rights reserved.
5 // http://www.telecom-paris.fr/~elc
6 //
7 
8 #ifndef Guit_Chart_hpp
9 #define Guit_Chart_hpp
10 #include <gchoicebox.hpp>
11 #include <gvalueitem.hpp>
12 namespace guit {
13 
28 class GChartBox : public GChoiceBox {
29 protected:
30  GChartBox(GadgetType&, GString const& css_and_title);
31 
32 public:
33  GChartBox(GString const& css_and_title = "");
34  GChartBox& clone(GClone const&) override;
35  GChartBox* toChartBox() override {return this;}
36 
37  virtual GChartBox& setRange(float min, float max);
38  float min() const {return min_;}
39  float max() const {return max_;}
40 
41  using GBox::add;
42  void add(Gadget* child, int pos = -1) override;
43  void add(Gadget& child, int index = -1) override {GChartBox::add(&child, index);}
44 
46  static GType& Type();
47  GType& type() const override {return Type();}
48 
49  Gadget& createDefaultItem(GString const& arg) override;
50  void initClone(Gadget& from, GClone const&) override;
51 
53  float min_{0.f}, max_{100.f};
54 };
55 
56 
58 GChartBox& ChartBox(GString const& css_and_title = "");
59 
60 
61 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
62 
63 
72 class GChartItem : public GValueItem {
73  GChartItem(GadgetType&, GString const& css_value_and_title);
74 
75 public:
76  GChartItem(GString const& css_value_and_title = "");
77  GChartItem(float value);
78 
79  GChartItem& clone(GClone const&) override;
80 
82  static GType& Type();
83  GType& type() const override {return Type();}
84 };
85 
86 
89 GChartItem& ChartItem(GString const& css_value_title = "");
90 GChartItem& ChartItem(float value);
92 
93 }
94 #endif