86 ClassImp(TControlBar);
91 TControlBar::TControlBar() : TControlBarButton()
102 TControlBar::TControlBar(
const char *orientation,
const char *title)
103 : TControlBarButton(title,
"",
"",
"button")
105 SetOrientation( orientation );
106 Initialize(-999, -999);
112 TControlBar::TControlBar(
const char *orientation,
const char *title, Int_t x, Int_t y)
113 : TControlBarButton(title,
"",
"",
"button")
115 Int_t xs = (Int_t)(x*gStyle->GetScreenFactor());
116 Int_t ys = (Int_t)(y*gStyle->GetScreenFactor());
117 SetOrientation( orientation );
124 TControlBar::~TControlBar()
126 delete fControlBarImp;
138 void TControlBar::AddButton(TControlBarButton &button)
140 AddButton( &button );
146 void TControlBar::AddButton(TControlBarButton *button)
148 if( fButtons && button )
149 fButtons->Add( button );
155 void TControlBar::AddButton(
const char *label,
const char *action,
const char *hint,
const char *type)
157 TControlBarButton *button =
new TControlBarButton( label, action, hint, type );
164 void TControlBar::AddControlBar(TControlBar &controlBar)
166 AddControlBar( &controlBar );
172 void TControlBar::AddControlBar(TControlBar *controlBar)
174 if( fButtons && controlBar )
175 fButtons->Add( controlBar );
181 void TControlBar::AddSeparator()
188 void TControlBar::Create()
190 if( fControlBarImp ) {
191 fControlBarImp->Create();
198 void TControlBar::Hide()
200 if( fControlBarImp ) {
201 fControlBarImp->Hide();
208 void TControlBar::Initialize(Int_t x, Int_t y)
214 gApplication->InitializeGraphics();
217 fControlBarImp = gGuiFactory->CreateControlBarImp(
this, GetName() );
219 fControlBarImp = gGuiFactory->CreateControlBarImp(
this, GetName(), x, y );
222 fButtons =
new TList();
233 void TControlBar::SetFont(
const char *fontName)
235 fControlBarImp->SetFont(fontName);
245 void TControlBar::SetTextColor(
const char *colorName)
247 fControlBarImp->SetTextColor(colorName);
267 void TControlBar::SetButtonState(
const char *label, Int_t state)
270 Error(
"SetButtonState",
"not valid button state (expecting 0, 1, 2 or 3)");
273 fControlBarImp->SetButtonState(label, state);
280 void TControlBar::SetButtonWidth(UInt_t width)
282 fControlBarImp->SetButtonWidth(width);
288 void TControlBar::SetOrientation(
const char *o)
290 fOrientation = kVertical;
293 if( !strcasecmp( o,
"vertical" ) )
294 fOrientation = kVertical;
295 else if( !strcasecmp( o,
"horizontal" ) )
296 fOrientation = kHorizontal;
298 Error(
"SetOrientation",
"Unknown orientation: '%s' !\n\t\t(choice of: %s, %s)",
299 o,
"vertical",
"horizontal" );
306 void TControlBar::SetOrientation(Int_t o)
308 fOrientation = kVertical;
310 if( ( o == kVertical ) || ( o == kHorizontal ) )
313 Error(
"SetOrientation",
"Unknown orientation: %d !\n\t\t(choice of: %d, %d)",
314 o, kVertical, kHorizontal );
320 void TControlBar::Show()
323 fControlBarImp->Show();
330 TControlBarButton *TControlBar::GetClicked()
const
332 if (!fControlBarImp->GetClicked())
333 Printf(
"None of the control bar buttons is clicked yet");
334 return fControlBarImp->GetClicked();