Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
30 class TGLPShapeObjEditor : public TGedFrame,
31  public TGLPShapeRef
32 {
33 
34 private:
35  enum ELightMode { kDiffuse, kAmbient, kSpecular, kEmission };
36  ELightMode fLMode;
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 
68  TGLPShapeObj *fPShapeObj; //model
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,
79  Pixel_t back = GetDefaultFrameBackground());
80  ~TGLPShapeObjEditor();
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
95  void CreateColorRadioButtons();
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