Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TStructNodeProperty.cxx
Go to the documentation of this file.
1// @(#)root/gviz3d:$Id$
2// Author: Tomasz Sosnicki 18/09/09
3
4/************************************************************************
5* Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. *
6* All rights reserved. *
7* *
8* For the licensing terms see $ROOTSYS/LICENSE. *
9* For the list of contributors see $ROOTSYS/README/CREDITS. *
10*************************************************************************/
11
12#include "TStructNodeProperty.h"
13#include <TROOT.h>
14#include <TClass.h>
15
16
17//________________________________________________________________________
18//////////////////////////////////////////////////////////////////////////
19//
20// TStructNodeProperty class keeps a color for type
21//
22//
23//
24//
25//
26//////////////////////////////////////////////////////////////////////////
27
28////////////////////////////////////////////////////////////////////////////////
29/// Contructs a TStructNodeProperty with p as parent window for class "name" with color "color".
30
32{
34 SetColor(color);
35}
36
37////////////////////////////////////////////////////////////////////////////////
38/// Contructs a TStructNodeProperty with p as parent window for class "name" with color "pixel".
39
45
46////////////////////////////////////////////////////////////////////////////////
47/// Destructor
48
52
53////////////////////////////////////////////////////////////////////////////////
54/// Overrided method. Compare two objects of TStructNodeProperty class
55
57{
58
59 // Default color "+" should be at the end.
60 if (fName == "+") {
61 return 1;
62 }
64 TString propName(prop->GetName());
65 if (propName == "+") {
66 return -1;
67 }
68
69 TClass* cl1;
70 if (fName.EndsWith("+")) {
72 } else {
74 }
75
76 TClass* cl2;
77
78 if (propName.EndsWith("+")) {
79 cl2 = TClass::GetClass(TString(propName.Data(), propName.Length()-1).Data());
80 } else {
81 cl2 = TClass::GetClass(prop->GetName());
82 }
83
84 if(!cl1) {
85 return -1;
86 }
87 if(!cl2) {
88 return -1;
89 }
90
91 if(cl1->InheritsFrom(cl2)) {
92 return -1;
93 }
94 if(cl2->InheritsFrom(cl1)) {
95 return 1;
96 }
97
98 if(this > prop) {
99 return 1;
100 }
101 if(this < prop) {
102 return -1;
103 }
104
105 return 0;
106}
107
108////////////////////////////////////////////////////////////////////////////////
109/// Returns color of class
110
112{
113 return fColor;
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Return color in Pixel_t format
118
120{
121 return fColor.GetPixel();
122}
123
124////////////////////////////////////////////////////////////////////////////////
125/// Retruns true, because we have overrided method Compare
126
128{
129 return true;
130}
131
132////////////////////////////////////////////////////////////////////////////////
133/// Sets the color to "color"
134
136{
137 fColor = color;
138}
139
140////////////////////////////////////////////////////////////////////////////////
141/// Sets the color to "color"
142
144{
145 fColor = *(gROOT->GetColor(color));
146}
147
148////////////////////////////////////////////////////////////////////////////////
149/// Sets the color to "pixel"
150
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h prop
char name[80]
Definition TGX11.cxx:110
#define gROOT
Definition TROOT.h:411
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2973
The color creation and management class.
Definition TColor.h:22
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1926
ULong_t GetPixel() const
Return pixel value corresponding to this color.
Definition TColor.cxx:1564
TString fName
Definition TNamed.h:32
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:138
Ssiz_t Length() const
Definition TString.h:425
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2250
const char * Data() const
Definition TString.h:384
Pixel_t GetPixel() const
Return color in Pixel_t format.
~TStructNodeProperty() override
Destructor.
TColor GetColor() const
Returns color of class.
Bool_t IsSortable() const override
Retruns true, because we have overrided method Compare.
void SetColor(const TColor &color)
Sets the color to "color".
TStructNodeProperty(const char *name, Int_t color)
Contructs a TStructNodeProperty with p as parent window for class "name" with color "color".
Int_t Compare(const TObject *obj) const override
Overrided method. Compare two objects of TStructNodeProperty class.