37 ClassImp(TGLManipSet);
39 TGLManipSet::TGLManipSet() :
40 TGLOverlayElement(kViewer),
46 fManip[kTrans] =
new TGLTransManip;
47 fManip[kScale] =
new TGLScaleManip;
48 fManip[kRotate] =
new TGLRotateManip;
54 TGLManipSet::~TGLManipSet()
56 for (Int_t i=kTrans; i<kEndType; ++i)
64 void TGLManipSet::SetPShape(TGLPhysicalShape* shape)
66 TGLPShapeRef::SetPShape(shape);
67 for (Int_t i=kTrans; i<kEndType; ++i)
68 fManip[i]->Attach(shape);
75 Bool_t TGLManipSet::MouseEnter(TGLOvlSelectRecord& )
77 TGLManip* manip = GetCurrentManip();
78 manip->SetActive(kFALSE);
79 manip->SetSelectedWidget(0);
87 Bool_t TGLManipSet::Handle(TGLRnrCtx& rnrCtx,
88 TGLOvlSelectRecord& selRec,
91 TGLManip* manip = GetCurrentManip();
97 return manip->HandleButton(*event, rnrCtx.RefCamera());
101 manip->SetActive(kFALSE);
106 if (manip->GetActive())
107 return manip->HandleMotion(*event, rnrCtx.RefCamera());
108 if (selRec.GetCurrItem() != manip->GetSelectedWidget())
110 manip->SetSelectedWidget(selRec.GetCurrItem());
117 switch (rnrCtx.GetEventKeySym())
119 case kKey_V:
case kKey_v:
120 SetManipType(kTrans);
122 case kKey_C:
case kKey_c:
123 SetManipType(kRotate);
125 case kKey_X:
case kKey_x:
126 SetManipType(kScale);
142 void TGLManipSet::MouseLeave()
144 TGLManip* manip = GetCurrentManip();
145 manip->SetActive(kFALSE);
146 manip->SetSelectedWidget(0);
152 void TGLManipSet::Render(TGLRnrCtx& rnrCtx)
157 if (rnrCtx.Selection())
159 TGLUtil::SetDrawQuality(12);
160 fManip[fType]->Draw(rnrCtx.RefCamera());
161 TGLUtil::ResetDrawQuality();
163 fManip[fType]->Draw(rnrCtx.RefCamera());
166 if (fDrawBBox && ! rnrCtx.Selection())
171 TGLUtil::Color(rnrCtx.ColorSet().Markup());
172 glDisable(GL_LIGHTING);
173 fPShape->BoundingBox().Draw();
174 glEnable(GL_LIGHTING);
181 void TGLManipSet::SetManipType(Int_t type)
183 if (type < 0 || type >= kEndType)
185 fType = (EManip) type;