#include "TControlBarButton.h"
#include "TCanvas.h"
#include "TError.h"
#include "TApplication.h"
#include <ctype.h>
const char *kBStr = "BUTTON";
const char *kDStr = "DRAWNBUTTON";
const char *kSStr = "SEPARATOR";
ClassImp(TControlBarButton)
TControlBarButton::TControlBarButton() : TNamed()
{
fType = 0;
}
TControlBarButton::TControlBarButton(const char *label, const char *action,
const char *hint, const char *type)
: TNamed(label, hint)
{
SetType(type);
SetAction(action);
}
void TControlBarButton::Action()
{
if (!fAction.IsNull()) {
gApplication->ProcessLine(fAction.Data());
if (gPad) gPad->Update();
}
}
void TControlBarButton::SetAction(const char *action)
{
if (action) {
char *s = Strip(action);
fAction = s;
delete [] s;
} else
Error("SetAction", "action missing");
}
void TControlBarButton::SetType(const char *type)
{
fType = kButton;
if (type && *type) {
if (!strcasecmp(type, kBStr))
fType = kButton;
else if (!strcasecmp(type, kDStr))
fType = kDrawnButton;
else if (!strcasecmp(type, kSStr))
fType = kSeparator;
else
Error("SetType", "unknown type '%s' !\n\t(choice of: %s, %s, %s)",
type, kBStr, kDStr, kSStr);
}
}
void TControlBarButton::SetType(Int_t type)
{
switch (type) {
case kButton:
case kDrawnButton:
case kSeparator:
fType = type;
break;
default:
fType = kButton;
Error("SetType", "unknown type: %d !\n\t(choice of: %d, %d, %d)",
type, kButton, kDrawnButton, kSeparator);
}
}
Last change: Wed Jun 25 08:35:49 2008
Last generated: 2008-06-25 08:35
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.