TGuiBldEditor.cxx

Go to the documentation of this file.
00001 // @(#)root/guibuilder:$Id: TGuiBldEditor.cxx 31799 2009-12-10 15:02:05Z bellenot $
00002 // Author: Valeriy Onuchin   12/09/04
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 //////////////////////////////////////////////////////////////////////////
00013 //                                                                      //
00014 // TGuiBldEditor - the property editor                                  //
00015 //                                                                      //
00016 //////////////////////////////////////////////////////////////////////////
00017 
00018 #include "TGuiBldEditor.h"
00019 #include "TRootGuiBuilder.h"
00020 #include "TGuiBldHintsEditor.h"
00021 #include "TGuiBldNameFrame.h"
00022 #include "TGuiBldGeometryFrame.h"
00023 #include "TGResourcePool.h"
00024 #include "TGTab.h"
00025 #include "TGLabel.h"
00026 #include "TGButtonGroup.h"
00027 #include "TGNumberEntry.h"
00028 #include "TG3DLine.h"
00029 #include "TGColorSelect.h"
00030 #include "TGColorDialog.h"
00031 #include "TGCanvas.h"
00032 #include "TGListTree.h"
00033 #include "TGuiBldDragManager.h"
00034 #include "TMethod.h"
00035 #include "TGMsgBox.h"
00036 #include "TGIcon.h"
00037 #include "TGFrame.h"
00038 #include "TGSplitter.h"
00039 #include "TGTableLayout.h"
00040 
00041 ClassImp(TGuiBldEditor)
00042 
00043 
00044 ////////////////////////////////////////////////////////////////////////////////
00045 class TGuiBldBorderFrame : public TGVerticalFrame {
00046 
00047 private:
00048    enum  EBldBorderFrameMode { 
00049       kBldBorderNone, kBldBorderSunken,
00050       kBldBorderPlain, kBldBorderRaised, 
00051       kBldBorderDouble };
00052 
00053 private:
00054    TGuiBldEditor   *fEditor;
00055    TGFrame         *fSelected;
00056    TGButtonGroup   *fBtnGroup;
00057    TGColorSelect   *fBgndFrame;
00058 
00059 public:
00060    TGuiBldBorderFrame(const TGWindow *p, TGuiBldEditor *editor);
00061    virtual ~TGuiBldBorderFrame() { }
00062 
00063    void  ChangeSelected(TGFrame*);
00064 };
00065 
00066 //______________________________________________________________________________
00067 TGuiBldBorderFrame::TGuiBldBorderFrame(const TGWindow *p, TGuiBldEditor *editor) :
00068              TGVerticalFrame(p, 1, 1)
00069 {
00070    // Constructor.
00071 
00072    fEditor = editor;
00073    fEditDisabled = 1;
00074    fBgndFrame = 0;
00075 
00076    SetCleanup(kDeepCleanup);
00077 
00078    fBtnGroup = new TGButtonGroup(this, "Border Mode");
00079 
00080    TGRadioButton *frame299 = new TGRadioButton(fBtnGroup," Sunken",kBldBorderSunken);
00081    frame299->SetToolTipText("Set a sunken border of the frame");
00082    TGRadioButton *frame302 = new TGRadioButton(fBtnGroup," None",kBldBorderPlain);
00083    frame302->SetToolTipText("Set no border of the frame");
00084    TGRadioButton *frame305 = new TGRadioButton(fBtnGroup," Raised",kBldBorderRaised);
00085    frame305->SetToolTipText("Set a raised border of the frame");
00086    frame305->SetState(kButtonDown);
00087    TGCheckButton *check = new TGCheckButton(fBtnGroup," Double",kBldBorderDouble);
00088    check->SetToolTipText("Set double border of the frame");
00089    //TQObject::Disconnect(check);
00090 
00091    fBtnGroup->SetRadioButtonExclusive(kTRUE);
00092    AddFrame(fBtnGroup, new TGLayoutHints(kLHintsCenterX | kLHintsTop));
00093    fBtnGroup->Connect("Pressed(Int_t)", "TGuiBldEditor", fEditor, "UpdateBorder(Int_t)");
00094    check->Connect("Pressed()", "TGuiBldEditor", fEditor, "UpdateBorder(=4)");
00095    check->Connect("Released()", "TGuiBldEditor", fEditor, "UpdateBorder(=5)");
00096 
00097    TGCompositeFrame *f = new TGGroupFrame(this, "Palette");
00098    TGHorizontalFrame *hf = new TGHorizontalFrame(f ,1, 1);
00099    fBgndFrame = new TGColorSelect(hf, 0, 1);
00100    fBgndFrame->SetEditDisabled();
00101    fBgndFrame->SetColor(GetDefaultFrameBackground());
00102    fBgndFrame->Connect("ColorSelected(Pixel_t)", "TGuiBldEditor", fEditor,
00103                        "UpdateBackground(Pixel_t)");
00104    hf->AddFrame(fBgndFrame, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2));
00105    hf->AddFrame(new TGLabel(hf, "Backgrnd"), new TGLayoutHints(kLHintsTop | 
00106                 kLHintsLeft, 2, 2, 2, 2));
00107    f->AddFrame(hf, new TGLayoutHints(kLHintsCenterX | kLHintsTop, 2, 2, 2, 2));
00108    AddFrame(f, new TGLayoutHints(kLHintsCenterX | kLHintsTop));
00109 }
00110 
00111 //______________________________________________________________________________
00112 void TGuiBldBorderFrame::ChangeSelected(TGFrame *frame)
00113 {
00114    // Perform actions when selected frame was changed.
00115 
00116    fSelected = frame;
00117 
00118    if (!frame) {
00119       return;
00120    }
00121 
00122    UInt_t opt = fSelected->GetOptions();
00123 
00124    fBtnGroup->SetButton(kBldBorderDouble, opt & kDoubleBorder);
00125    fBtnGroup->SetButton(kBldBorderSunken, opt & kSunkenFrame);
00126    fBtnGroup->SetButton(kBldBorderRaised, opt & kRaisedFrame);
00127    fBtnGroup->SetButton(kBldBorderPlain, !(opt & kRaisedFrame) && !(opt & kSunkenFrame));
00128 
00129    if (fBgndFrame) {
00130       TQObject::Disconnect(fBgndFrame);
00131       fBgndFrame->SetColor(fSelected->GetBackground());
00132       fBgndFrame->Connect("ColorSelected(Pixel_t)", "TGuiBldEditor", fEditor, "UpdateBackground(Pixel_t)");
00133    }
00134 }
00135 
00136 ////////////////////////////////////////////////////////////////////////////////
00137 //______________________________________________________________________________
00138 TGuiBldEditor::TGuiBldEditor(const TGWindow *p) : TGVerticalFrame(p, 1, 1)
00139 {
00140    // Constructor.
00141 
00142    TGHorizontalFrame *hf;
00143    TGVerticalFrame *vf;
00144    fSelected = 0;
00145    SetCleanup(kDeepCleanup);
00146 
00147    fNameFrame  = new TGuiBldNameFrame(this, this);
00148    AddFrame(fNameFrame,  new TGLayoutHints(kLHintsNormal | kLHintsExpandX,5,5,2,2));
00149 
00150    TGHSplitter *splitter = new TGHSplitter(this,100,5);
00151    AddFrame(splitter, new TGLayoutHints(kLHintsTop | kLHintsExpandX,0,0,5,5));
00152    splitter->SetFrame(fNameFrame, kTRUE);
00153 
00154    //------------frame with layout switch
00155    hf = new TGHorizontalFrame(this);
00156    hf->AddFrame(new TGLabel(hf, "Composite Frame Layout"), 
00157                 new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
00158    hf->AddFrame(new TGHorizontal3DLine(hf), new TGLayoutHints(kLHintsTop | 
00159                 kLHintsExpandX, 2, 2, 2, 2));
00160    AddFrame(hf, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 2, 2));
00161    
00162    vf = new TGVerticalFrame(this);
00163    fLayoutLabel = new TGLabel(vf, "Automatic Layout Disabled");
00164    vf->AddFrame(fLayoutLabel, new TGLayoutHints(kLHintsCenterX | kLHintsTop,
00165                 2, 2, 2, 2));
00166    
00167    fLayoutButton = new TGTextButton(vf,"    Enable layout    ");
00168    fLayoutButton->SetEnabled(kFALSE);
00169    vf->AddFrame(fLayoutButton, new TGLayoutHints(kLHintsCenterX | kLHintsTop,
00170                 2, 2, 2, 2));
00171 
00172    AddFrame(vf, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 2, 2, 2));
00173 
00174    AddFrame(new TGHorizontal3DLine(this), new TGLayoutHints(kLHintsTop | 
00175             kLHintsExpandX, 2, 2, 2, 2));
00176 
00177    fLayoutButton->Connect("Clicked()", "TGuiBldEditor", this, "SwitchLayout()");
00178    fLayoutButton->SetToolTipText("If layout is on, all the frame \nelements get layouted automatically.");
00179 
00180    //-----------------------------
00181 
00182    fTab = new TGTab(this, 80, 40);
00183    AddFrame(fTab, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2));
00184    fTablay = fTab->AddTab("Layout");
00185    TGCompositeFrame *tabcont = fTab->AddTab("Style");
00186    fLayoutId = 1; // 2nd tab
00187    fTab->Connect("Selected(Int_t)", "TGuiBldEditor", this, "TabSelected(Int_t)");
00188 
00189    fHintsFrame = new TGuiBldHintsEditor(fTablay, this);
00190    fTablay->AddFrame(fHintsFrame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
00191                      2, 2, 2, 2));
00192 
00193    fGeomFrame = new TGuiBldGeometryFrame(fTablay, this);
00194    fTablay->AddFrame(fGeomFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX,
00195                      2, 2, 2, 2));
00196 
00197    //----------------Position X,Y boxes---------------
00198 
00199    fPositionFrame = new TGGroupFrame(fTablay, "Position");
00200 
00201    hf = new TGHorizontalFrame(fPositionFrame);
00202 
00203    vf = new TGVerticalFrame(hf);
00204    vf->SetLayoutManager(new TGTableLayout(vf, 2, 2));
00205 
00206    vf->AddFrame(new TGLabel(vf, " X "), new TGTableLayoutHints(0, 1, 0, 1,
00207                 kLHintsCenterY | kLHintsLeft, 2, 2, 2, 2));
00208    fXpos = new TGNumberEntry(vf, 0.0, 4, -1, (TGNumberFormat::EStyle)5);
00209    vf->AddFrame(fXpos, new TGTableLayoutHints(1, 2, 0, 1, kLHintsCenterY | 
00210                 kLHintsLeft, 2, 2, 2, 2));
00211 
00212    vf->AddFrame(new TGLabel(vf, " Y "), new TGTableLayoutHints(0, 1, 1, 2,
00213                 kLHintsCenterY | kLHintsLeft, 2, 2, 2, 2));
00214    fYpos = new TGNumberEntry(vf, 0.0, 4, -1, (TGNumberFormat::EStyle)5);
00215    vf->AddFrame(fYpos, new TGTableLayoutHints(1, 2, 1, 2, kLHintsCenterY | 
00216                 kLHintsLeft, 2, 2, 2, 2));
00217 
00218    hf->AddFrame(vf, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY));
00219 
00220    vf = new TGVerticalFrame(hf);
00221    vf->SetLayoutManager(new TGTableLayout(vf, 3, 3));
00222 
00223    TGTextButton *fTextButton6366 = new TGTextButton(vf, "^", -1, 
00224                 TGButton::GetDefaultGC()(), 
00225                 TGTextButton::GetDefaultFontStruct(),
00226                 kRaisedFrame | kDoubleBorder | kFixedSize);
00227    fTextButton6366->Resize(20,20);
00228    vf->AddFrame(fTextButton6366, new TGTableLayoutHints(1, 2, 0, 1,
00229                 kLHintsLeft | kLHintsTop, 1, 1, 1, 1));
00230 
00231    TGTextButton *fTextButton6367 = new TGTextButton(vf, "v", -1, 
00232                 TGButton::GetDefaultGC()(), 
00233                 TGTextButton::GetDefaultFontStruct(),
00234                 kRaisedFrame | kDoubleBorder | kFixedSize);
00235    fTextButton6367->Resize(20,20);
00236    vf->AddFrame(fTextButton6367, new TGTableLayoutHints(1, 2, 2, 3,
00237                 kLHintsLeft | kLHintsTop, 1, 1, 1, 1));
00238 
00239    TGTextButton *fTextButton6364 = new TGTextButton(vf, "<", -1, 
00240                 TGButton::GetDefaultGC()(), 
00241                 TGTextButton::GetDefaultFontStruct(),
00242                 kRaisedFrame | kDoubleBorder | kFixedSize);
00243    fTextButton6364->Resize(20,20);
00244    vf->AddFrame(fTextButton6364, new TGTableLayoutHints(0, 1, 1, 2,
00245                 kLHintsLeft | kLHintsTop, 1, 1, 1, 1));
00246 
00247    TGTextButton *fTextButton6365 = new TGTextButton(vf, ">", -1, 
00248                 TGButton::GetDefaultGC()(), 
00249                 TGTextButton::GetDefaultFontStruct(),
00250                 kRaisedFrame | kDoubleBorder | kFixedSize);
00251    fTextButton6365->Resize(20,20);
00252    vf->AddFrame(fTextButton6365, new TGTableLayoutHints(2, 3, 1, 2,
00253                 kLHintsLeft | kLHintsTop, 1, 1, 1, 1));
00254 
00255    hf->AddFrame(vf, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY));
00256 
00257    fPositionFrame->AddFrame(hf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
00258    
00259    fTablay->AddFrame(fPositionFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
00260 
00261    fXpos->Connect("ValueSet(Long_t)", "TGuiBldHintsEditor", fHintsFrame, "SetPosition()");
00262    fYpos->Connect("ValueSet(Long_t)", "TGuiBldHintsEditor", fHintsFrame, "SetPosition()");
00263 
00264    fTextButton6364->Connect("Clicked()", "TGNumberEntry", fXpos, "IncreaseNumber(TGNumberFormat::EStepSize=0,-1)");
00265    fTextButton6364->Connect("Clicked()", "TGuiBldHintsEditor", fHintsFrame, "SetPosition()");
00266    fTextButton6365->Connect("Clicked()", "TGNumberEntry", fXpos, "IncreaseNumber()");
00267    fTextButton6365->Connect("Clicked()", "TGuiBldHintsEditor", fHintsFrame, "SetPosition()");
00268    fTextButton6366->Connect("Clicked()", "TGNumberEntry", fYpos, "IncreaseNumber(TGNumberFormat::EStepSize=0,-1)");
00269    fTextButton6366->Connect("Clicked()", "TGuiBldHintsEditor", fHintsFrame, "SetPosition()");
00270    fTextButton6367->Connect("Clicked()", "TGNumberEntry", fYpos, "IncreaseNumber()");
00271    fTextButton6367->Connect("Clicked()", "TGuiBldHintsEditor", fHintsFrame, "SetPosition()");
00272 
00273    //----------------------------------------------------
00274 
00275    fBorderFrame = new TGuiBldBorderFrame(tabcont, this);
00276    tabcont->AddFrame(fBorderFrame, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
00277 
00278    MapSubwindows();
00279    SetWindowName("Frame Property Editor");
00280    SetEditDisabled(1);
00281 
00282    fEmbedded = kFALSE;
00283 }
00284 
00285 //______________________________________________________________________________
00286 TGuiBldEditor::~TGuiBldEditor()
00287 {
00288    // Destructor.
00289 
00290 }
00291 
00292 //______________________________________________________________________________
00293 void TGuiBldEditor::RemoveFrame(TGFrame *frame)
00294 {
00295    // Remove a frame.
00296 
00297    fNameFrame->RemoveFrame(frame);
00298 }
00299 
00300 //______________________________________________________________________________
00301 void TGuiBldEditor::TabSelected(Int_t id)
00302 {
00303    // Handle  selected.
00304 
00305    if (id == fLayoutId) {
00306       //printf("%d\n", fSelected);
00307    }
00308 }
00309 
00310 //______________________________________________________________________________
00311 void TGuiBldEditor::Hide()
00312 {
00313    // Hide editor.
00314 
00315    UnmapWindow();
00316 }
00317 
00318 //______________________________________________________________________________
00319 void TGuiBldEditor::ChangeSelected(TGFrame *frame)
00320 {
00321    // Change selected frame.
00322 
00323    TGTabElement *tab = fTab->GetTabTab(fLayoutId);
00324 
00325    if (!frame) {
00326       fNameFrame->ChangeSelected(0);
00327       //fTab->SetTab(0);
00328       tab->SetEnabled(kFALSE);
00329       fClient->NeedRedraw(tab);
00330       return;
00331    }
00332 
00333    fSelected = frame;
00334    TGWindow *parent = (TGWindow*)fSelected->GetParent();
00335 
00336    fNameFrame->ChangeSelected(fSelected);
00337 
00338    Bool_t enable_layout = kFALSE;
00339    enable_layout |= parent && !(parent->GetEditDisabled() & kEditDisableLayout);
00340    enable_layout |= !(fSelected->GetEditDisabled() & kEditDisableLayout);
00341    enable_layout |= parent && (parent->InheritsFrom(TGCompositeFrame::Class()) &&
00342                      !((TGCompositeFrame*)parent)->IsLayoutBroken());
00343    enable_layout |= (fSelected->InheritsFrom(TGCompositeFrame::Class()) &&
00344                      !((TGCompositeFrame*)fSelected)->IsLayoutBroken());
00345 
00346    if (enable_layout) {
00347       fHintsFrame->ChangeSelected(fSelected);
00348 
00349       if (tab) {
00350          tab->SetEnabled(kTRUE);
00351          fClient->NeedRedraw(tab);
00352       }
00353    } else {
00354       fHintsFrame->ChangeSelected(0);
00355 
00356       if (tab) {
00357          fTab->SetTab(0);
00358          tab->SetEnabled(kFALSE);
00359          fClient->NeedRedraw(tab);
00360       }
00361    }
00362 
00363    if ((frame->InheritsFrom(TGHorizontalFrame::Class())) ||
00364        (frame->InheritsFrom(TGVerticalFrame::Class())) ||
00365        (frame->InheritsFrom(TGGroupFrame::Class())) ) {
00366 
00367       fLayoutButton->SetEnabled(kTRUE);
00368       if (fSelected->IsLayoutBroken()) {
00369          fLayoutButton->SetText("    Enable layout    ");
00370          fLayoutLabel->SetText("Automatic layout disabled");
00371          if (fTablay) {
00372             fTablay->ShowFrame(fGeomFrame);
00373             fTablay->ShowFrame(fPositionFrame);
00374             fTablay->HideFrame(fHintsFrame);
00375          }
00376       } else {
00377          fLayoutButton->SetText("    Disable layout    ");
00378          fLayoutLabel->SetText("Automatic layout enabled");
00379          if (fTablay) {
00380             fTablay->HideFrame(fGeomFrame);
00381             fTablay->HideFrame(fPositionFrame);
00382             fTablay->ShowFrame(fHintsFrame);
00383          }
00384       }
00385    }
00386    else {
00387       fLayoutButton->SetEnabled(kFALSE);
00388       TGFrame *parentf = (TGFrame*)frame->GetParent();
00389       if (parentf->IsLayoutBroken()) {
00390          fLayoutButton->SetText("    Enable layout    ");
00391          fLayoutLabel->SetText("Automatic layout disabled");
00392          fTablay->ShowFrame(fGeomFrame);
00393          fTablay->ShowFrame(fPositionFrame);
00394          fTablay->HideFrame(fHintsFrame);
00395       } else {
00396          fLayoutButton->SetText("    Disable layout    ");
00397          fLayoutLabel->SetText("Automatic layout enabled");
00398          fTablay->HideFrame(fGeomFrame);
00399          fTablay->HideFrame(fPositionFrame);
00400          fTablay->ShowFrame(fHintsFrame);
00401       }
00402    }
00403 
00404    fYpos->SetIntNumber(frame->GetY());
00405    fXpos->SetIntNumber(frame->GetX());
00406 
00407    if (fBorderFrame) fBorderFrame->ChangeSelected(fSelected);
00408    if (fGeomFrame) fGeomFrame->ChangeSelected(fSelected);
00409 
00410    Emit("ChangeSelected(TGFrame*)", (long)fSelected);
00411 
00412    MapRaised();
00413 }
00414 
00415 //______________________________________________________________________________
00416 void TGuiBldEditor::UpdateSelected(TGFrame *frame)
00417 {
00418    // Update selected frame.
00419 
00420    Emit("UpdateSelected(TGFrame*)", (long)frame);
00421 }
00422 
00423 //______________________________________________________________________________
00424 void TGuiBldEditor::UpdateBorder(Int_t b)
00425 {
00426    // Update border of selected frame.
00427 
00428    if (!fSelected) return;
00429 
00430    UInt_t opt = fSelected->GetOptions();
00431 
00432    switch (b) {
00433       case 1:
00434          opt &= ~kRaisedFrame;
00435          opt |= kSunkenFrame;
00436          break;
00437       case 2:
00438          opt &= ~kSunkenFrame;
00439          opt &= ~kRaisedFrame;
00440          break;
00441       case 3:
00442          opt &= ~kSunkenFrame;
00443          opt |= kRaisedFrame;
00444          break;
00445       case 4:
00446          opt |= kDoubleBorder;
00447          break;
00448       case 5:
00449          opt &= ~kDoubleBorder;
00450          break;
00451       default:
00452          return;
00453    }
00454    fSelected->ChangeOptions(opt);
00455    fClient->NeedRedraw(fSelected, kTRUE);
00456 }
00457 
00458 //______________________________________________________________________________
00459 void TGuiBldEditor::UpdateBackground(Pixel_t col)
00460 {
00461    // Update background.
00462 
00463    if (!fSelected) return;
00464 
00465    fSelected->SetBackgroundColor(col);
00466    fClient->NeedRedraw(fSelected, kTRUE);
00467 }
00468 
00469 //______________________________________________________________________________
00470 void TGuiBldEditor::UpdateForeground(Pixel_t col)
00471 {
00472    // Update foreground.
00473 
00474    if (!fSelected) return;
00475 
00476    fSelected->SetForegroundColor(col);
00477    fClient->NeedRedraw(fSelected, kTRUE);
00478 }
00479 
00480 //______________________________________________________________________________
00481 void TGuiBldEditor::Reset()
00482 {
00483    // Reset the editor.
00484 
00485    fSelected = 0;
00486    fNameFrame->Reset();
00487    TGTabElement *tab = fTab->GetTabTab(fLayoutId);
00488    fTab->SetTab(0);
00489    tab->SetEnabled(kFALSE);
00490 }
00491 
00492 //______________________________________________________________________________
00493 void TGuiBldEditor::SwitchLayout()
00494 {
00495    // Popup dialog to set layout of editted frame off. If layout is on, all
00496    // the elements in the frame get layouted automatically.
00497 
00498    if (!fSelected) {
00499       fLayoutButton->SetText("    Enable layout    ");
00500       fLayoutButton->SetEnabled(kFALSE);
00501       fLayoutLabel->SetText("Automatic layout disabled");
00502       if (fTablay) {
00503          fTablay->ShowFrame(fGeomFrame);
00504          fTablay->ShowFrame(fPositionFrame);
00505          fTablay->HideFrame(fHintsFrame);
00506       }
00507       return;
00508    }
00509 
00510    TRootGuiBuilder *builder = (TRootGuiBuilder*)TRootGuiBuilder::Instance();
00511    TGFrame *frame = fSelected;
00512    TGCompositeFrame *cf = fNameFrame->GetMdi(frame);
00513    if (cf == 0)
00514       return;
00515    if (frame->IsLayoutBroken()) {
00516       Int_t retval;
00517       builder->GetManager()->SetEditable(kFALSE);
00518       new TGMsgBox(gClient->GetDefaultRoot(), builder, "Layout change",
00519                    "Enabling layout will automatically align and resize all the icons. \n Do you really want to layout them?",
00520                    kMBIconExclamation, kMBOk | kMBCancel, &retval);
00521 
00522       cf->SetEditable(kTRUE);
00523       // hack against selecting the message box itself
00524       builder->GetManager()->SelectFrame(frame);
00525       frame->SetEditable(kTRUE);
00526 
00527       if (retval == kMBOk) {
00528          frame->SetLayoutBroken(kFALSE);
00529          frame->Layout();
00530          fLayoutButton->SetText("    Disable layout    ");
00531          fLayoutLabel->SetText("Automatic layout enabled");
00532          if (fTablay) {
00533             fTablay->HideFrame(fGeomFrame);
00534             fTablay->HideFrame(fPositionFrame);
00535             fTablay->ShowFrame(fHintsFrame);
00536             fTablay->Resize(fHintsFrame->GetWidth(),fHintsFrame->GetHeight());
00537          }
00538       }
00539    } else {
00540       //set layout off - without dialog, because nothing "bad" can happen
00541       frame->SetLayoutBroken(kTRUE);
00542       fLayoutButton->SetText("    Enable layout    ");
00543       fLayoutLabel->SetText("Automatic layout disabled");
00544       if (fTablay) {
00545          fTablay->ShowFrame(fGeomFrame);
00546          fTablay->ShowFrame(fPositionFrame);
00547          fTablay->HideFrame(fHintsFrame);
00548       }
00549    }
00550    fClient->NeedRedraw(frame, kTRUE);
00551    if (fTablay) fClient->NeedRedraw(fTablay, kTRUE);
00552 }
00553 
00554 
00555 

Generated on Tue Jul 5 14:22:14 2011 for ROOT_528-00b_version by  doxygen 1.5.1