10 #include "../Controllers/ControllerIndicatorTHStock.h"
12 #include "../CommonXAxis.h"
19 enum EIdentifier { HSId1, BtId1, BtId2 };
27 #ifdef DEBUG_CONT_FRAME
28 std::cout <<
"Entry Constructor THStockFrame name_frame " << name_frame << std::endl;
31 SetCleanup( kDeepCleanup );
36 ChangeOptions( ( this->GetOptions() & ~kFitWidth ) | kFitWidth );
39 SetName ( name_frame );
43 std::string name_cstock =
"CStock_" + Utils::toString<const char *>( name_frame );
44 #ifdef DEBUG_CONT_FRAME
45 std::cout <<
"name of the CanvasStock " << name_cstock << std::endl;
51 fECanvas =
new TRootEmbeddedCanvas(0,
this, 650, 400);
52 std::cout <<
"fECanvas " <<
fECanvas << std::endl;
55 Int_t wid =
fECanvas->GetCanvasWindowId();
66 #ifdef DEBUG_CONT_FRAME
67 std::cout <<
"Adopt new CanvasStock " <<
fCStock << std::endl;
73 AddFrame (
fECanvas,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY) );
79 fCStock->Connect(
"Selected(TVirtualPad*,TObject*,Int_t)",
"THStockFrame",
this,
"GetSignalSelected( TVirtualPad*,TObject*,Int_t )" );
81 #ifdef DEBUG_CONT_FRAME
82 std::cout <<
"fECanvas " <<
fECanvas << std::endl;
83 std::cout <<
"fCStock->GetMother()" <<
fCStock->GetMother() << std::endl;
84 std::cout <<
"fCStock->GetMother()->GetMother()" <<
fCStock->GetMother()->GetMother() << std::endl;
85 std::cout <<
"this (THStockFrame) " <<
this << std::endl;
90 AddFrame(
fslider_frame,
new TGLayoutHints( kLHintsExpandX ,2,2,2,2) );
95 fButslider[0]->Connect(
"Clicked()",
"THStockFrame",
this,
"HandleButton()");
106 fHslider1->Connect(
"PositionChanged()",
"THStockFrame",
this,
"DoSlider()");
111 fButslider[1]->Connect(
"Clicked()",
"THStockFrame",
this,
"HandleButton()");
117 #ifdef DEBUG_CONT_FRAME
118 std::cout <<
"Destructor THStockFrame" << std::endl;
132 #ifdef DEBUG_CONT_FRAME
133 std::cout <<
"Entry THStockFrame::DoSlider()" << std::endl;
135 std::cout <<
"GetMinPosition() " <<
fHslider1->GetMinPosition();
136 std::cout <<
"GetMaxPosition() " <<
fHslider1->GetMaxPosition() << std::endl;
137 std::cout <<
"Will call fCStock->UpdateTHStock() " << std::endl;
145 #ifdef DEBUG_CONT_FRAME
148 std::cout <<
" Exit Do Slider " << std::endl;
156 #ifdef DEBUG_CONT_FRAME
157 std::cout <<
"Entry THStockFrame::HandleButton()" << std::endl;
161 TGButton *btn = (TGButton *) gTQSender;
162 id = btn->WidgetId();
171 #ifdef DEBUG_CONT_FRAME
172 std::cout <<
" GetMinPosition() " <<
fHslider1->GetMinPosition();
173 std::cout <<
" GetMaxPosition() " <<
fHslider1->GetMaxPosition() << std::endl;
174 std::cout <<
" fmin " << fmin <<
" fmax " << fmax << std::endl;
181 #ifdef DEBUG_CONT_FRAME
182 std::cout <<
"Press Minus id" <<
id << std::endl;
195 #ifdef DEBUG_CONT_FRAME
196 std::cout <<
"move the slider BtId1 " << std::endl;
199 ( (fmin - 5.0) > 0.0 ) ? ( fmin-=5.0 ) : ( fmin = 0.0 );
206 #ifdef DEBUG_CONT_FRAME
207 std::cout <<
"Press Plus " << std::endl;
210 if ( fmax < 100.0 ) {
213 ( (fmax + 5.0) < 100.0 ) ? ( fmax+=5.0 ) : ( fmax=100.0 );
217 #ifdef DEBUG_CONT_FRAME
218 std::cout <<
"move the slider BtId2, want to see future " << std::endl;
219 std::cout <<
"will increase size of the common axis of 1" << std::endl;
231 #ifdef DEBUG_CONT_FRAME
232 std::cout <<
"new Slider fmin " << fmin <<
" fmax " << fmax << std::endl;
249 std::cout <<
"Exit THStockFrame::HandleButton" << std::endl;
256 std::string frame_name;
260 #ifdef DEBUG_CONT_FRAME
262 std::cout <<
"Entry Slot THStockFrame::GetSignalSelected " << std::endl;
283 std::cout <<
"pad->GetMother()->GetName() " << pad->GetMother()->GetName() << std::endl;
284 std::cout <<
"pad->GetNumber() " << pad->GetNumber() << std::endl;
285 std::cout <<
"frame_name = gPad->GetName() " << frame_name << std::endl;
293 frame_name = pad->GetMother()->GetName();
294 frame_name.erase(0,7);
295 std::cout <<
" after erase frame_name " << frame_name << std::endl;
296 std::cout <<
"fcontroller " <<
fcontroller << std::endl;
315 #ifdef DEBUG_CONT_FRAME
316 std::cout <<
"End GetSignalSelected " << std::endl;
Owns a vector of THStock.
void GetSelected(int pad_number)
void GetSignalSelected(TVirtualPad *, TObject *, Int_t)
TGTextButton * fButslider[2]
ClassImp(THStockFrame) enum EIdentifier
TRootEmbeddedCanvas * fECanvas
contain one embedded CanvasStock
THStockFrame(const TGWindow *p, const char *, UInt_t w, UInt_t h)
constructor, destructor
TGHorizontalFrame * fslider_frame
CanvasStock * fCStock
1 CanvasStock for each frame, easier
Contains an EmbeddedCanvas and a CanvasStock.
void SetRangeCommonAxis(Double_t MinPos, Double_t MaxPos)
interface to CommonXaxis.
TGDoubleHSlider * fHslider1
ControllerIndicatorTHStock * fcontroller
CommonXAxis * GetCommonAxis() const
void UpdateCommonAxis(int new_size)
Resize CommonXaxis, increase size of the axis Update the range (bins) of the Axis (fFirst...
void UpdateTHStock()
to redefine