28 ClassImp(TRootControlBar);
33 TRootControlBar::TRootControlBar(TControlBar *c,
const char *title, Int_t x, Int_t y)
34 : TGMainFrame(gClient->GetRoot(), 10, 10), TControlBarImp(c)
41 SetCleanup(kDeepCleanup);
44 if (c && c->GetOrientation() == TControlBar::kHorizontal) {
45 ChangeOptions(kHorizontalFrame);
46 fL1 =
new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1);
48 fL1 =
new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 1, 1, 1, 1);
57 TRootControlBar::~TRootControlBar()
67 void TRootControlBar::Create()
72 TControlBarButton *button;
73 TIter next(fControlBar->GetListOfButtons());
75 while ((button = (TControlBarButton *) next())) {
77 switch (button->GetType()) {
79 case TControlBarButton::kSeparator:
80 Warning(
"Create",
"separators not yet supported");
83 case TControlBarButton::kDrawnButton:
84 Warning(
"Create",
"picture buttons not yet supported");
87 case TControlBarButton::kButton:
89 b =
new TGTextButton(
this, button->GetName());
90 b->SetToolTipText(button->GetTitle());
91 b->SetUserData(button);
94 if (fBwidth < b->GetDefaultWidth())
95 fBwidth = b->GetDefaultWidth();
102 Resize(GetDefaultSize());
104 SetMWMHints(kMWMDecorAll | kMWMDecorResizeH,
105 kMWMFuncAll | kMWMFuncResize | kMWMFuncMaximize,
110 SetWMPosition(fXpos, fYpos);
112 if (GetOptions() & kHorizontalFrame)
113 SetWMSize(fBwidth*fWidgets->GetSize(), GetHeight());
115 SetWMSize(fBwidth, GetHeight());
121 void TRootControlBar::Show()
123 if (!fWidgets) Create();
131 void TRootControlBar::Hide()
139 Bool_t TRootControlBar::ProcessMessage(Long_t, Long_t, Long_t parm2)
141 TControlBarButton *button = (TControlBarButton *) parm2;
153 void TRootControlBar::ReallyDelete()
161 void TRootControlBar::CloseWindow()
169 void TRootControlBar::SetFont(
const char *fontName)
171 TIter next(fWidgets);
175 while ((obj=next())) {
176 if (!obj->InheritsFrom(TGTextButton::Class()))
continue;
178 ((TGTextButton *)obj)->SetFont(fontName);
186 void TRootControlBar::SetButtonState(
const char *label, Int_t state)
188 TIter next(fWidgets);
192 while ((obj=next())) {
193 if (!obj->InheritsFrom(TGTextButton::Class()))
continue;
195 if (!strcmp(((TGTextButton *)obj)->GetTitle(), label)) {
198 ((TGTextButton *)obj)->SetState(kButtonUp);
202 ((TGTextButton *)obj)->SetState(kButtonDown);
206 ((TGTextButton *)obj)->SetState(kButtonEngaged);
210 ((TGTextButton *)obj)->SetState(kButtonDisabled);
214 Error(
"SetButtonState",
"not valid button state (expecting 0, 1, 2 or 3)");
228 void TRootControlBar::SetTextColor(
const char *colorName)
231 gClient->GetColorByName(colorName, color);
233 if (!fWidgets) Create();
235 TIter next(fWidgets);
239 while ((obj=next())) {
240 if (!obj->InheritsFrom(TGTextButton::Class()))
continue;
242 ((TGTextButton *)obj)->SetTextColor(color);
250 void TRootControlBar::SetButtonWidth(UInt_t width)