3 class TGCompositeFrame;
6 TGFrame *GetFrame(
const TGCompositeFrame *frame,Int_t
id);
20 FilterDialog(
const char *wName=0,
const char **NamVal=0,
const float *defs=0,
float *vals=0,
int *flagg=0);
26 TGFrame *GetFrame(UInt_t
id);
30 const char* NamValQQ[]={
44 const float DefsQQ[]={
59 FilterDialog::FilterDialog(
const char *wName,
const char **NamVal,
const float *defs,
float *vals,
int *flagg)
61 printf(
"*** FilterDialog::FilterDialog STARTED ***\n");
64 if (!wName) wName =
"DefaultFilterDialog";
66 if(!fNamVal) fNamVal = NamValQQ;
68 if (!fDefs) fDefs = DefsQQ;
70 if (!fVals) fVals = DefsQQ;
74 for (nRow=0;fNamVal[nRow];nRow++){};
85 UInt_t uHintsNam = kLHintsCenterY | kLHintsExpandX;
86 UInt_t uHintsVal = kLHintsCenterY | kLHintsExpandX;
89 fFrame =
new TGMainFrame(gClient->GetRoot()
90 ,PixInLetX*(LetInNam+LetInVal)+10,PixInLetY*(nRow+2));
92 fFrame->SetWindowName(wName);
94 TGTableLayout *lay =
new TGTableLayout(fFrame,(nRow+2)*nGridY,(LetInNam+1+LetInVal+1)*nGridX);
95 fFrame->SetLayoutManager(lay);
99 TGTableLayoutHints *hi = 0;
100 int jRowTop,jRowBot,jColLeft,jColRite;
101 for (
int iRow=0;iRow<nRow;iRow++) {
103 tw =
new TGTextView(fFrame,PixInLetX*LetInNam,PixInLetY,fNamVal[iRow]);
104 tw->SetUniqueID(1000*(iRow+1)+1);
105 jRowTop = iRow*nGridY; jRowBot = (iRow+1)*nGridY-1;
106 jColLeft=0; jColRite = (LetInNam+1)*nGridX-1;
107 hi =
new TGTableLayoutHints(jColLeft,jColRite,jRowTop,jRowBot,uHintsNam);
108 fFrame->AddFrame(tw,hi);
110 sprintf(cbuf,
"%+10g",fVals[iRow]);
111 te =
new TGTextEntry(fFrame,cbuf);
112 te->SetUniqueID(1000*(iRow+1)+2);
113 te->SetWidth( PixInLetX*LetInVal);
114 te->SetHeight(PixInLetY);
115 jColLeft =jColRite +1;jColRite = jColLeft+(LetInVal+1)*nGridX-1;
116 hi =
new TGTableLayoutHints(jColLeft,jColRite,jRowTop,jRowBot,uHintsVal);
117 fFrame->AddFrame(te,hi);
121 TGTextButton *bat =0;
122 sprintf(cbuf,
"((FilterDialog*)%p)->Update();",
this);
123 bat =
new TGTextButton(fFrame,
" OK ",cbuf);
124 jRowTop = nRow*nGridY; jRowBot = (nRow+1)*nGridY-1;
125 jColLeft=0; jColRite = (LetInNam+1)*nGridX-1;
126 hi =
new TGTableLayoutHints(jColLeft,jColRite,jRowTop,jRowBot,uHintsNam);
127 fFrame->AddFrame(bat,hi);
131 sprintf(cbuf,
"((FilterDialog*)%p)->Reset();",
this);
132 bat =
new TGTextButton(fFrame,
"Default Values",cbuf);
133 jColLeft =jColRite +1;jColRite = jColLeft+(LetInVal+1)*nGridX-1;
134 hi =
new TGTableLayoutHints(jColLeft,jColRite,jRowTop,jRowBot,uHintsVal);
135 fFrame->AddFrame(bat,hi);
138 printf(
"*** FilterDialog::FilterDialog FINISHED ***\n");
141 FilterDialog::~FilterDialog()
143 printf(
"*** FilterDialog::~FilterDialog STARTED ***\n");
144 TList *list = fFrame->GetList();
145 TListIter nextFrame(list);
146 TGFrameElement *fe=0;
147 while ((fe=(TGFrameElement*)nextFrame())) {
delete fe->fFrame;}
152 printf(
"*** After Destroy ***\n");
156 printf(
"*** FilterDialog::~FilterDialog FINISHED ***\n");
160 void FilterDialog::Reset()
163 for (
int irow=0; irow<fNVals; irow++) {
164 int id = (irow+1)*1000+2;
165 TGTextEntry *te = (TGTextEntry*)GetFrame(
id);
167 sprintf(cbuf,
"%+10g",fDefs[irow]);
173 void FilterDialog::Update()
175 printf(
"*** FilterDialog::Update STARTED ***\n");
177 for (
int irow=0; irow<fNVals; irow++) {
178 int id = (irow+1)*1000+2;
179 TGTextEntry *te = (TGTextEntry*)GetFrame(
id);
182 float f = strtod(txt,0);
184 if (fVals) fVals[irow]=f;
189 printf(
"*** FilterDialog::Update FINISHED ***\n");
192 void FilterDialog::Show()
195 fFrame->MapSubwindows();
199 TGFrame *FilterDialog::GetFrame(UInt_t
id)
201 return ::GetFrame(fFrame,
id);
204 TGFrame *GetFrame(
const TGCompositeFrame *frame,UInt_t
id)
206 TList *tl = frame->GetList();
209 while ((el = (TGFrameElement *)next())) {
210 TGFrame *fr = el->fFrame;
213 if (fr->GetUniqueID()==id)
break;