ROOT  6.06/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 #ifndef ROOT_TGedFrame
10 #include "TGedFrame.h"
11 #endif
12 
13 #ifndef ROOT_TGLUtil
14 #include "TGLUtil.h"
15 #endif
16 
17 #include "TGLPShapeRef.h"
18 
19 class TGLPShapeObj;
20 class TGLayoutHints;
21 class TGCheckButton;
22 class TGNumberEntry;
23 class TGButtonGroup;
24 class TGroupFrame;
25 class TGHSlider;
26 class TGRadioButton;
27 class TGTabElement;
28 class TGButton;
29 class TGLViewer;
30 class TGTab;
31 
32 class TGLWidget;
33 
35  public TGLPShapeRef
36 {
37 
38 private:
41 
42  TGLayoutHints fLb; //button layout
43  TGLayoutHints fLe; //num entry layout
44  TGLayoutHints fLl; //label layout
45  TGLayoutHints fLs; //slider layout
46 
47  TGCompositeFrame *fGeoFrame; //orientation, clipping
48 
49  // "Geometry" tab's controls
50  TGNumberEntry *fGeomData[6]; //position and clipping control
51  TGButton *fGeoApplyButton; //action button
52 
53  // "Color" tab's controls
54  TGCompositeFrame *fColorFrame; //top frame for color componet control
55  TGLWidget *fMatView; //inner structure to handle sphere GL window
56 
57  TGButton *fLightTypes[4]; //light type
58 
59  TGHSlider *fRedSlider; //red component of selected material
60  TGHSlider *fGreenSlider; //green component of selected material
61  TGHSlider *fBlueSlider; //blue component of selected material
62  TGHSlider *fAlphaSlider; //alpha component of selected material lider;
63  TGHSlider *fShineSlider; //specular refelction of selected material
64 
65  TGButton *fColorApplyButton; //apply to selected
66  TGButton *fColorApplyFamily; //apply to selected and family
67  Float_t fRGBA[17]; //color multiplet
68 
69  Window_t fGLWin; //GL window with sphere
70  ULong_t fCtx; //GL context
71 
73 
74  void CreateGeoControls();
75  void CreateColorControls();
76 
77  virtual void DoRedraw();
78 
79 public:
80  TGLPShapeObjEditor(const TGWindow *p = 0,
81  Int_t width = 140, Int_t height = 30,
82  UInt_t options = kChildFrame,
85 
86  // Virtuals from TGLPShapeRef
87  virtual void SetPShape(TGLPhysicalShape * shape);
88  virtual void PShapeModified();
89 
90  virtual void SetModel(TObject* obj);
91 
92  // geometry
93  void SetCenter(const Double_t *center);
94  void SetScale(const Double_t *scale);
95  void DoGeoButton();
96  void GetObjectData(Double_t *shift, Double_t *scale);
97  void GeoValueSet(Long_t unusedVal);
98  //colors
100  void CreateColorSliders();
101  void SetColorSlidersPos();
102 
103  void DrawSphere()const;
104 
105  void SetRGBA(const Float_t *rgba);
106  const Float_t *GetRGBA()const{return fRGBA;}
107  //color slots
108  void DoColorSlider(Int_t val);
109  void DoColorButton();
110 
111  ClassDef(TGLPShapeObjEditor, 0); //GUI for editing attributes of a physical-shape.
112 };
113 
114 #endif
const Float_t * GetRGBA() const
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:66
float Float_t
Definition: RtypesCore.h:53
GUI editor for TGLPShapeObj.
void DrawSphere() const
Draw local sphere reflecting current color options.
int Int_t
Definition: RtypesCore.h:41
TGLPShapeObj * fPShapeObj
virtual void DoRedraw()
Redraw widget. Render sphere and pass to base-class.
TGCompositeFrame * fGeoFrame
virtual void SetPShape(TGLPhysicalShape *shape)
Shape has changed.
Concrete physical shape - a GL drawable.
ULong_t Pixel_t
Definition: GuiTypes.h:41
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 'center' scale in 3 component 'scale'...
void SetScale(const Double_t *scale)
Set internal scale data from 3 component 'c'.
TGButton * fColorApplyFamily
void SetRGBA(const Float_t *rgba)
Set color sliders from 17 component 'rgba'.
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:35
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.
ClassDef(TGLPShapeObjEditor, 0)
void SetCenter(const Double_t *center)
Set internal center data from 3 component 'c'.
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 'Apply' - update the viewer object from GUI.
Mother of all ROOT objects.
Definition: TObject.h:58
Handle_t Window_t
Definition: GuiTypes.h:30
void GeoValueSet(Long_t unusedVal)
Process setting of value in edit box - activate 'Apply' button.
~TGLPShapeObjEditor()
Destroy color editor GUI component.
void SetColorSlidersPos()
Update GUI sliders from internal data.
TObject * obj
void DoColorSlider(Int_t val)
Process slider movement.
void CreateColorRadioButtons()
Create Diffuse/Ambient/Specular/Emissive radio buttons and sub-frames.