Logo ROOT   6.10/09
Reference Guide
TGLPShapeObjEditor.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Matevz Tadel 25/09/2006
3 
4 #ifndef ROOT_TGLPShapeObjEditor
5 #define ROOT_TGLPShapeObjEditor
6 
7 #include <memory>
8 
9 #include "TGedFrame.h"
10 
11 #include "TGLUtil.h"
12 
13 #include "TGLPShapeRef.h"
14 
15 class TGLPShapeObj;
16 class TGLayoutHints;
17 class TGCheckButton;
18 class TGNumberEntry;
19 class TGButtonGroup;
20 class TGroupFrame;
21 class TGHSlider;
22 class TGRadioButton;
23 class TGTabElement;
24 class TGButton;
25 class TGLViewer;
26 class TGTab;
27 
28 class TGLWidget;
29 
31  public TGLPShapeRef
32 {
33 
34 private:
37 
38  TGLayoutHints fLb; //button layout
39  TGLayoutHints fLe; //num entry layout
40  TGLayoutHints fLl; //label layout
41  TGLayoutHints fLs; //slider layout
42 
43  TGCompositeFrame *fGeoFrame; //orientation, clipping
44 
45  // "Geometry" tab's controls
46  TGNumberEntry *fGeomData[6]; //position and clipping control
47  TGButton *fGeoApplyButton; //action button
48 
49  // "Color" tab's controls
50  TGCompositeFrame *fColorFrame; //top frame for color componet control
51  TGLWidget *fMatView; //inner structure to handle sphere GL window
52 
53  TGButton *fLightTypes[4]; //light type
54 
55  TGHSlider *fRedSlider; //red component of selected material
56  TGHSlider *fGreenSlider; //green component of selected material
57  TGHSlider *fBlueSlider; //blue component of selected material
58  TGHSlider *fAlphaSlider; //alpha component of selected material lider;
59  TGHSlider *fShineSlider; //specular refelction of selected material
60 
61  TGButton *fColorApplyButton; //apply to selected
62  TGButton *fColorApplyFamily; //apply to selected and family
63  Float_t fRGBA[17]; //color multiplet
64 
65  Window_t fGLWin; //GL window with sphere
66  ULong_t fCtx; //GL context
67 
69 
70  void CreateGeoControls();
71  void CreateColorControls();
72 
73  virtual void DoRedraw();
74 
75 public:
76  TGLPShapeObjEditor(const TGWindow *p = 0,
77  Int_t width = 140, Int_t height = 30,
78  UInt_t options = kChildFrame,
81 
82  // Virtuals from TGLPShapeRef
83  virtual void SetPShape(TGLPhysicalShape * shape);
84  virtual void PShapeModified();
85 
86  virtual void SetModel(TObject* obj);
87 
88  // geometry
89  void SetCenter(const Double_t *center);
90  void SetScale(const Double_t *scale);
91  void DoGeoButton();
92  void GetObjectData(Double_t *shift, Double_t *scale);
93  void GeoValueSet(Long_t unusedVal);
94  //colors
96  void CreateColorSliders();
97  void SetColorSlidersPos();
98 
99  void DrawSphere()const;
100 
101  void SetRGBA(const Float_t *rgba);
102  const Float_t *GetRGBA()const{return fRGBA;}
103  //color slots
104  void DoColorSlider(Int_t val);
105  void DoColorButton();
106 
107  ClassDef(TGLPShapeObjEditor, 0); //GUI for editing attributes of a physical-shape.
108 };
109 
110 #endif
virtual void PShapeModified()
Shape has been modified.
Wrap TGLPysicalShape into TObject so that it can be edited using GED.
Definition: TGLPShapeObj.h:20
Definition: TGTab.h:62
float Float_t
Definition: RtypesCore.h:53
GUI editor for TGLPShapeObj.
int Int_t
Definition: RtypesCore.h:41
TGLPShapeObj * fPShapeObj
virtual void DoRedraw()
Redraw widget. Render sphere and pass to base-class.
TGCompositeFrame * fGeoFrame
TGButton * fLightTypes[4]
virtual void SetPShape(TGLPhysicalShape *shape)
Shape has changed.
Concrete physical shape - a GL drawable.
#define ClassDef(name, id)
Definition: Rtypes.h:297
ULong_t Pixel_t
Definition: GuiTypes.h:39
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
TGButton * fColorApplyButton
void CreateColorControls()
Create widgets to chose colors component and its RGBA values on fGedEditor model or family it belongs...
virtual void SetModel(TObject *obj)
Sets model or disables/hides viewer.
void GetObjectData(Double_t *shift, Double_t *scale)
Extract the GUI object data, return center in 3 component &#39;center&#39; scale in 3 component &#39;scale&#39;...
void SetScale(const Double_t *scale)
Set internal scale data from 3 component &#39;c&#39;.
TGButton * fColorApplyFamily
void SetRGBA(const Float_t *rgba)
Set color sliders from 17 component &#39;rgba&#39;.
void DoColorButton()
Process button action.
unsigned int UInt_t
Definition: RtypesCore.h:42
TGCompositeFrame * fColorFrame
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition: TGLViewer.h:53
GL window with context.
Definition: TGLWidget.h:27
Base class for references to TGLPysicalShape that need to be notified when the shape is destroyed...
Definition: TGLPShapeRef.h:19
TGLPShapeObjEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of TGLPhysicalShape editor GUI.
void DrawSphere() const
Draw local sphere reflecting current color options.
TGNumberEntry * fGeomData[6]
void SetCenter(const Double_t *center)
Set internal center data from 3 component &#39;c&#39;.
long Long_t
Definition: RtypesCore.h:50
double Double_t
Definition: RtypesCore.h:55
void CreateGeoControls()
Create GUI for setting scale and position.
void CreateColorSliders()
Create GUI for setting light color.
unsigned long ULong_t
Definition: RtypesCore.h:51
void DoGeoButton()
Process &#39;Apply&#39; - update the viewer object from GUI.
Mother of all ROOT objects.
Definition: TObject.h:37
Handle_t Window_t
Definition: GuiTypes.h:28
void GeoValueSet(Long_t unusedVal)
Process setting of value in edit box - activate &#39;Apply&#39; button.
~TGLPShapeObjEditor()
Destroy color editor GUI component.
void SetColorSlidersPos()
Update GUI sliders from internal data.
void DoColorSlider(Int_t val)
Process slider movement.
const Float_t * GetRGBA() const
void CreateColorRadioButtons()
Create Diffuse/Ambient/Specular/Emissive radio buttons and sub-frames.