18enum ETestCommandIdentifiers {
43 ~TTripleSliderDemo()
override;
46 void DoText(
const char *
text);
63 AddFrame(fCanvas, fLcan);
64 fCanvas->GetCanvas()->SetFillColor(33);
65 fCanvas->GetCanvas()->SetFrameFillColor(41);
66 fCanvas->GetCanvas()->SetBorderMode(0);
67 fCanvas->GetCanvas()->SetGrid();
68 fCanvas->GetCanvas()->SetLogy();
76 fCheck1->SetToolTipText(
"Pointer position constrained to slider sides");
77 fCheck2->SetToolTipText(
"Pointer position relative to slider position");
79 fHframe0->Resize(200, 50);
85 fHslider1->Connect(
"PointerPositionChanged()",
"TTripleSliderDemo",
this,
"DoSlider()");
86 fHslider1->Connect(
"PositionChanged()",
"TTripleSliderDemo",
this,
"DoSlider()");
87 fHslider1->SetRange(0.05, 5.0);
89 fHframe1->Resize(200, 25);
97 fTeh1->SetToolTipText(
"Minimum (left) Value of Slider");
98 fTeh2->SetToolTipText(
"Pointer Position Value");
99 fTeh3->SetToolTipText(
"Maximum (right) Value of Slider");
101 fTbh1->AddText(0,
"0.0");
102 fTbh2->AddText(0,
"0.0");
103 fTbh3->AddText(0,
"0.0");
105 fTeh1->Connect(
"TextChanged(char*)",
"TTripleSliderDemo",
this,
"DoText(char*)");
106 fTeh2->Connect(
"TextChanged(char*)",
"TTripleSliderDemo",
this,
"DoText(char*)");
107 fTeh3->Connect(
"TextChanged(char*)",
"TTripleSliderDemo",
this,
"DoText(char*)");
109 fCheck1->Connect(
"Clicked()",
"TTripleSliderDemo",
this,
"HandleButtons()");
110 fCheck2->Connect(
"Clicked()",
"TTripleSliderDemo",
this,
"HandleButtons()");
112 fHframe2->Resize(100, 25);
122 fHframe0->AddFrame(fCheck1, fBfly2);
123 fHframe0->AddFrame(fCheck2, fBfly2);
124 fHframe1->AddFrame(fHslider1, fBly);
125 fHframe2->AddFrame(fTeh1, fBfly2);
126 fHframe2->AddFrame(fTeh2, fBfly1);
127 fHframe2->AddFrame(fTeh3, fBfly3);
129 AddFrame(fHframe0, fBly);
130 AddFrame(fHframe1, fBly);
131 AddFrame(fHframe2, fBly);
135 SetWindowName(
"Triple Slider Demo");
137 Resize(GetDefaultSize());
140 fFitFcn =
new TF1(
"fFitFcn",
"TMath::LogNormal(x, [0], [1], [2])", 0, 5);
141 fFitFcn->SetRange(0.0, 2.5);
142 fFitFcn->SetParameters(1.0, 0, 1);
143 fFitFcn->SetMinimum(1.0e-3);
144 fFitFcn->SetMaximum(10.0);
145 fFitFcn->SetLineColor(
kRed);
146 fFitFcn->SetLineWidth(1);
149 fHslider1->SetPosition(0.05, 2.5);
150 fHslider1->SetPointerPosition(1.0);
152 sprintf(buf,
"%.3f", fHslider1->GetMinPosition());
154 fTbh1->AddText(0, buf);
155 sprintf(buf,
"%.3f", fHslider1->GetPointerPosition());
157 fTbh2->AddText(0, buf);
158 sprintf(buf,
"%.3f", fHslider1->GetMaxPosition());
160 fTbh3->AddText(0, buf);
164TTripleSliderDemo::~TTripleSliderDemo()
172void TTripleSliderDemo::CloseWindow()
180void TTripleSliderDemo::DoText(
const char * )
188 case HId1: fHslider1->SetPosition((
Float_t)atof(fTbh1->GetString()), (
Float_t)fHslider1->GetMaxPosition());
break;
189 case HId2: fHslider1->SetPointerPosition((
Float_t)atof(fTbh2->GetString()));
break;
190 case HId3: fHslider1->SetPosition((
Float_t)fHslider1->GetMinPosition(), (
Float_t)atof(fTbh1->GetString()));
break;
193 fFitFcn->SetParameters(fHslider1->GetPointerPosition(), 0, 1);
194 fFitFcn->SetRange(fHslider1->GetMinPosition() - 0.05, fHslider1->GetMaxPosition());
196 fCanvas->GetCanvas()->Modified();
197 fCanvas->GetCanvas()->Update();
201void TTripleSliderDemo::DoSlider()
207 sprintf(buf,
"%.3f", fHslider1->GetMinPosition());
209 fTbh1->AddText(0, buf);
210 fTeh1->SetCursorPosition(fTeh1->GetCursorPosition());
214 sprintf(buf,
"%.3f", fHslider1->GetPointerPosition());
216 fTbh2->AddText(0, buf);
217 fTeh2->SetCursorPosition(fTeh2->GetCursorPosition());
221 sprintf(buf,
"%.3f", fHslider1->GetMaxPosition());
223 fTbh3->AddText(0, buf);
224 fTeh3->SetCursorPosition(fTeh3->GetCursorPosition());
228 fFitFcn->SetParameters(fHslider1->GetPointerPosition(), 0, 1);
229 fFitFcn->SetRange(fHslider1->GetMinPosition() - 0.05, fHslider1->GetMaxPosition());
231 fCanvas->GetCanvas()->Modified();
232 fCanvas->GetCanvas()->Update();
236void TTripleSliderDemo::HandleButtons()
244 case HCId1: fHslider1->SetConstrained(fCheck1->GetState());
break;
245 case HCId2: fHslider1->SetRelative(fCheck2->GetState());
break;
252 new TTripleSliderDemo();
#define ClassDef(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize MapSubwindows
Option_t Option_t TPoint TPoint const char text
R__EXTERN void * gTQSender
A composite frame that layout their children in horizontal way.
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
virtual void CloseWindow()
Close and delete main frame.
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
A TGTextEntry is a one line text input widget.
TripleSlider inherit from DoubleSlider widgets and allow easy selection of a min, max and pointer val...
This class creates a TGCanvas in which a TCanvas is created.