File indexing completed on 2025-01-18 10:10:50
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef ROOT7_TObjectDrawable
0010 #define ROOT7_TObjectDrawable
0011
0012 #include <ROOT/RDrawable.hxx>
0013 #include <ROOT/RAttrValue.hxx>
0014 #include <ROOT/RAttrLine.hxx>
0015 #include <ROOT/RAttrText.hxx>
0016 #include <ROOT/RAttrMarker.hxx>
0017 #include <ROOT/RAttrFill.hxx>
0018
0019 class TObject;
0020 class TColor;
0021 class TClass;
0022
0023 namespace ROOT {
0024 namespace Experimental {
0025
0026 class RPadBase;
0027 class TObjectDisplayItem;
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 class TObjectDrawable final : public RDrawable {
0038 private:
0039
0040 enum {
0041 kNone = 0,
0042 kObject = 1,
0043 };
0044
0045 int fKind{kNone};
0046 Internal::RIOShared<TObject> fObj;
0047 const TObject *fExtObj{nullptr};
0048
0049 static std::string GetColorCode(TColor *col);
0050
0051 std::unique_ptr<TObject> CreateSpecials(int kind);
0052
0053 protected:
0054
0055 void CollectShared(Internal::RIOSharedVector_t &vect) final { vect.emplace_back(&fObj); }
0056
0057 std::unique_ptr<RDisplayItem> Display(const RDisplayContext &) override;
0058
0059 void PopulateMenu(RMenuItems &) final;
0060
0061 void Execute(const std::string &) final;
0062
0063 static void ExtractObjectColors(std::unique_ptr<TObjectDisplayItem> &item, const TObject *obj);
0064
0065 static void CheckOwnership(TObject *obj);
0066
0067 static const char *DetectCssType(const TObject *obj);
0068
0069 public:
0070
0071 enum EKind {
0072 kColors = 4,
0073 kStyle = 5,
0074 kPalette = 6
0075 };
0076
0077 RAttrLine line{this, "line"};
0078 RAttrFill fill{this, "fill"};
0079 RAttrMarker marker{this, "marker"};
0080 RAttrText text{this, "text"};
0081 RAttrValue<std::string> options{this, "options"};
0082
0083 TObjectDrawable();
0084 TObjectDrawable(TObject *obj, bool isowner = false);
0085 TObjectDrawable(TObject *obj, const std::string &opt, bool isowner = false);
0086 TObjectDrawable(const std::shared_ptr<TObject> &obj);
0087 TObjectDrawable(const std::shared_ptr<TObject> &obj, const std::string &opt);
0088 TObjectDrawable(EKind kind, bool persistent = false);
0089 ~TObjectDrawable() override;
0090
0091 void Reset();
0092
0093 void Set(TObject *obj, bool isowner = false);
0094 void Set(TObject *obj, const std::string &opt, bool isowner = false);
0095
0096 const TObject *Get();
0097 };
0098
0099 }
0100 }
0101
0102
0103 #endif