TEveWindow.h

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: TEveWindow.h 32138 2010-01-28 15:16:30Z matevz $
00002 // Author: Matevz Tadel 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, 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 #ifndef ROOT_TEveWindow
00013 #define ROOT_TEveWindow
00014 
00015 #include "TEveElement.h"
00016 
00017 #include "TGFrame.h"
00018 
00019 class TEveWindow;
00020 class TEveWindowSlot;
00021 class TEveWindowFrame;
00022 class TEveWindowMainFrame;
00023 class TEveWindowPack;
00024 class TEveWindowTab;
00025 
00026 class TContextMenu;
00027 
00028 class TGButton;
00029 class TGSplitButton;
00030 class TGTextButton;
00031 
00032 class TGPack;
00033 class TGTab;
00034 
00035 //==============================================================================
00036 // TEveCompositeFrame
00037 //==============================================================================
00038 
00039 class TEveCompositeFrame : public TGCompositeFrame
00040 {
00041    friend class TEveWindow;
00042    friend class TEveWindowManager;
00043 
00044 public:
00045    typedef TGFrame* (*IconBarCreator_foo)(TEveCompositeFrame*, TGCompositeFrame*, Int_t);
00046 
00047 private:
00048    TEveCompositeFrame(const TEveCompositeFrame&);            // Not implemented
00049    TEveCompositeFrame& operator=(const TEveCompositeFrame&); // Not implemented
00050 
00051    static IconBarCreator_foo fgIconBarCreator;
00052    static UInt_t             fgTopFrameHeight;
00053    static UInt_t             fgMiniBarHeight;
00054    static Bool_t             fgAllowTopFrameCollapse;
00055 
00056 protected:
00057    TGCompositeFrame  *fTopFrame;
00058    TGTextButton      *fToggleBar;
00059    TGTextButton      *fTitleBar;
00060    TGFrame           *fIconBar;
00061    TGLayoutHints     *fEveWindowLH;
00062 
00063    TGFrame           *fMiniBar;
00064 
00065    TEveElement       *fEveParent;
00066    TEveWindow        *fEveWindow;
00067 
00068    Bool_t             fShowInSync;
00069 
00070    static TContextMenu *fgCtxMenu;
00071    static const TString fgkEmptyFrameName;
00072 
00073    static TList        *fgFrameList;
00074 
00075 public:
00076    TEveCompositeFrame(TGCompositeFrame* gui_parent, TEveWindow* eve_parent);
00077    virtual ~TEveCompositeFrame();
00078 
00079    virtual void WindowNameChanged(const TString& name);
00080 
00081    virtual void Destroy() = 0;
00082 
00083    virtual void        AcquireEveWindow(TEveWindow* ew);
00084    virtual TEveWindow* RelinquishEveWindow(Bool_t reparent=kTRUE);
00085 
00086    TEveWindow* GetEveWindow() const { return fEveWindow; }
00087    TEveWindow* GetEveParentAsWindow() const;
00088 
00089    virtual void SetCurrent(Bool_t curr);
00090    virtual void SetShowTitleBar(Bool_t show);
00091    virtual void HideAllDecorations();
00092    virtual void ShowNormalDecorations();
00093 
00094    void ActionPressed();
00095    void FlipTitleBarState();
00096    void TitleBarClicked();
00097 
00098    static void SetupFrameMarkup(IconBarCreator_foo creator,
00099                                 UInt_t top_frame_height   = 14,
00100                                 UInt_t mini_bar_height    = 4,
00101                                 Bool_t allow_top_collapse = kTRUE);
00102 
00103    ClassDef(TEveCompositeFrame, 0); // Composite frame containing eve-window-controls and eve-windows.
00104 };
00105 
00106 
00107 //==============================================================================
00108 // TEveCompositeFrameInMainFrame
00109 //==============================================================================
00110 
00111 class TEveCompositeFrameInMainFrame : public TEveCompositeFrame
00112 {
00113 private:
00114    TEveCompositeFrameInMainFrame(const TEveCompositeFrameInMainFrame&);            // Not implemented
00115    TEveCompositeFrameInMainFrame& operator=(const TEveCompositeFrameInMainFrame&); // Not implemented
00116 
00117 protected:
00118    TGMainFrame      *fMainFrame;
00119    TEveWindow       *fOriginalSlot;
00120    TEveWindow       *fOriginalContainer;
00121 
00122 public:
00123    TEveCompositeFrameInMainFrame(TGCompositeFrame* parent, TEveWindow* eve_parent,
00124                                  TGMainFrame* mf);
00125    virtual ~TEveCompositeFrameInMainFrame();
00126 
00127    virtual void WindowNameChanged(const TString& name);
00128 
00129    virtual void Destroy();
00130 
00131    void SetOriginalSlotAndContainer(TEveWindow* slot, TEveWindow* container);
00132 
00133    void SomeWindowClosed(TEveWindow* w);
00134    void MainFrameClosed();
00135 
00136    TEveWindow* GetOriginalSlot() const { return fOriginalSlot; }
00137    TEveWindow* GetOriginalContainer() const { return fOriginalContainer; }
00138 
00139    ClassDef(TEveCompositeFrameInMainFrame, 0); // Eve-composite-frame that is contained in one tab of a TGTab.
00140 };
00141 
00142 
00143 //==============================================================================
00144 // TEveCompositeFrameInPack
00145 //==============================================================================
00146 
00147 class TEveCompositeFrameInPack : public TEveCompositeFrame
00148 {
00149 private:
00150    TEveCompositeFrameInPack(const TEveCompositeFrameInPack&);            // Not implemented
00151    TEveCompositeFrameInPack& operator=(const TEveCompositeFrameInPack&); // Not implemented
00152 
00153 protected:
00154    TGPack        *fPack;
00155 
00156 public:
00157    TEveCompositeFrameInPack(TGCompositeFrame* parent, TEveWindow* eve_parent,
00158                             TGPack* pack);
00159    virtual ~TEveCompositeFrameInPack();
00160 
00161    virtual void Destroy();
00162 
00163    ClassDef(TEveCompositeFrameInPack, 0); // Eve-composite-frame that is contained in a TGPack.
00164 };
00165 
00166 
00167 //==============================================================================
00168 // TEveCompositeFrameInTab
00169 //==============================================================================
00170 
00171 class TEveCompositeFrameInTab : public TEveCompositeFrame
00172 {
00173 private:
00174    TEveCompositeFrameInTab(const TEveCompositeFrameInTab&);            // Not implemented
00175    TEveCompositeFrameInTab& operator=(const TEveCompositeFrameInTab&); // Not implemented
00176 
00177 protected:
00178    TGTab            *fTab;
00179    TGCompositeFrame *fParentInTab;
00180 
00181    Int_t FindTabIndex();
00182 
00183 public:
00184    TEveCompositeFrameInTab(TGCompositeFrame* parent, TEveWindow* eve_parent,
00185                            TGTab* tab);
00186    virtual ~TEveCompositeFrameInTab();
00187 
00188    virtual void WindowNameChanged(const TString& name);
00189 
00190    virtual void Destroy();
00191 
00192    virtual void SetCurrent(Bool_t curr);
00193 
00194    ClassDef(TEveCompositeFrameInTab, 0); // Eve-composite-frame that is contained in one tab of a TGTab.
00195 };
00196 
00197 
00198 //==============================================================================
00199 //==============================================================================
00200 // TEveWindow classes
00201 //==============================================================================
00202 //==============================================================================
00203 
00204 
00205 //==============================================================================
00206 // TEveWindow
00207 //==============================================================================
00208 
00209 class TEveWindow : public TEveElementList
00210 {
00211    friend class TEveWindowManager;
00212 
00213 private:
00214    TEveWindow(const TEveWindow&);            // Not implemented
00215    TEveWindow& operator=(const TEveWindow&); // Not implemented
00216 
00217 protected:
00218    TEveCompositeFrame  *fEveFrame;
00219    Bool_t               fShowTitleBar;
00220 
00221    virtual void SetCurrent(Bool_t curr);
00222 
00223    static UInt_t        fgMainFrameDefWidth;
00224    static UInt_t        fgMainFrameDefHeight;
00225 
00226    static Pixel_t       fgCurrentBackgroundColor;
00227    static Pixel_t       fgMiniBarBackgroundColor;
00228 
00229    virtual void PreDeleteElement();
00230 
00231 public:
00232    TEveWindow(const char* n="TEveWindow", const char* t="");
00233    virtual ~TEveWindow();
00234 
00235    virtual void NameTitleChanged();
00236 
00237    virtual TGFrame*        GetGUIFrame() = 0;
00238    virtual void            PreUndock();
00239    virtual void            PostDock();
00240 
00241    virtual Bool_t          CanMakeNewSlots() const { return kFALSE; }
00242    virtual TEveWindowSlot* NewSlot() { return 0; }
00243 
00244    void PopulateEmptyFrame(TEveCompositeFrame* ef);
00245 
00246    void SwapWindow(TEveWindow* w);
00247    void SwapWindowWithCurrent();        // *MENU*
00248 
00249    void UndockWindow();                 // *MENU*
00250    void UndockWindowDestroySlot();      // *MENU*
00251 
00252    void ReplaceWindow(TEveWindow* w);
00253 
00254    virtual void DestroyWindow();        // *MENU*
00255    virtual void DestroyWindowAndSlot(); // *MENU*
00256 
00257    TEveCompositeFrame* GetEveFrame()  { return fEveFrame; }
00258    void                ClearEveFrame();
00259 
00260    void   FlipShowTitleBar()      { SetShowTitleBar(!fShowTitleBar); }
00261    Bool_t GetShowTitleBar() const { return fShowTitleBar; }
00262    void   SetShowTitleBar(Bool_t x);
00263 
00264    Bool_t IsCurrent() const;
00265    void   MakeCurrent();
00266 
00267 
00268    Bool_t IsAncestorOf(TEveWindow* win);
00269 
00270    void   TitleBarClicked();
00271 
00272 
00273    // Static helper functions for common window management scenarios.
00274 
00275    static TEveWindowSlot* CreateDefaultWindowSlot();
00276    static TEveWindowSlot* CreateWindowMainFrame(TEveWindow* eve_parent=0);
00277    static TEveWindowSlot* CreateWindowInTab(TGTab* tab, TEveWindow* eve_parent=0);
00278 
00279    static void            SwapWindows(TEveWindow* w1, TEveWindow* w2);
00280 
00281    // Access to static data-members.
00282 
00283    static UInt_t  GetMainFrameDefWidth();
00284    static UInt_t  GetMainFrameDefHeight();
00285    static void    SetMainFrameDefWidth (UInt_t x);
00286    static void    SetMainFrameDefHeight(UInt_t x);
00287 
00288    static Pixel_t GetCurrentBackgroundColor();
00289    static Pixel_t GetMiniBarBackgroundColor();
00290    static void    SetCurrentBackgroundColor(Pixel_t p);
00291    static void    SetMiniBarBackgroundColor(Pixel_t p);
00292 
00293    ClassDef(TEveWindow, 0); // Abstract base-class for eve-windows.
00294 };
00295 
00296 
00297 //==============================================================================
00298 // TEveWindowSlot
00299 //==============================================================================
00300 
00301 class TEveWindowSlot : public TEveWindow
00302 {
00303 private:
00304    TEveWindowSlot(const TEveWindowSlot&);            // Not implemented
00305    TEveWindowSlot& operator=(const TEveWindowSlot&); // Not implemented
00306 
00307 protected:
00308    TGTextButton      *fEmptyButt;
00309    TGCompositeFrame  *fEmbedBuffer;
00310 
00311    virtual void SetCurrent(Bool_t curr);
00312 
00313 public:
00314    TEveWindowSlot(const char* n="TEveWindowSlot", const char* t="");
00315    virtual ~TEveWindowSlot();
00316 
00317    virtual TGFrame* GetGUIFrame();
00318 
00319    TEveWindowPack*   MakePack(); // *MENU*
00320    TEveWindowTab*    MakeTab();  // *MENU*
00321 
00322    TEveWindowFrame*  MakeFrame(TGFrame* frame=0);
00323 
00324    TGCompositeFrame* StartEmbedding();
00325    TEveWindowFrame*  StopEmbedding(const char* name=0);
00326 
00327    ClassDef(TEveWindowSlot, 0); // An unoccupied eve-window slot.
00328 };
00329 
00330 
00331 //==============================================================================
00332 // TEveWindowFrame
00333 //==============================================================================
00334 
00335 class TEveWindowFrame : public TEveWindow
00336 {
00337 private:
00338    TEveWindowFrame(const TEveWindowFrame&);            // Not implemented
00339    TEveWindowFrame& operator=(const TEveWindowFrame&); // Not implemented
00340 
00341 protected:
00342    TGFrame         *fGUIFrame;
00343 
00344 public:
00345    TEveWindowFrame(TGFrame* frame, const char* n="TEveWindowFrame", const char* t="");
00346    virtual ~TEveWindowFrame();
00347 
00348    virtual TGFrame* GetGUIFrame() { return fGUIFrame; }
00349 
00350    TGCompositeFrame* GetGUICompositeFrame();
00351 
00352    ClassDef(TEveWindowFrame, 0); // Eve-window containing any TGFrame.
00353 };
00354 
00355 
00356 //==============================================================================
00357 // TEveWindowPack
00358 //==============================================================================
00359 
00360 class TEveWindowPack : public TEveWindow
00361 {
00362 private:
00363    TEveWindowPack(const TEveWindowPack&);            // Not implemented
00364    TEveWindowPack& operator=(const TEveWindowPack&); // Not implemented
00365 
00366 protected:
00367    TGPack          *fPack;
00368 
00369 public:
00370    TEveWindowPack(TGPack* p, const char* n="TEveWindowPack", const char* t="");
00371    virtual ~TEveWindowPack();
00372 
00373    virtual TGFrame*        GetGUIFrame();
00374 
00375    virtual Bool_t          CanMakeNewSlots() const { return kTRUE; }
00376    virtual TEveWindowSlot* NewSlotWithWeight(Float_t w);
00377    virtual TEveWindowSlot* NewSlot(); // *MENU*
00378 
00379    void FlipOrientation(); // *MENU*
00380    void SetVertical(Bool_t x=kTRUE);
00381    void SetHorizontal() { SetVertical(kFALSE); }
00382 
00383    void EqualizeFrames();  // *MENU*
00384 
00385    TGPack* GetPack() const { return fPack; }
00386 
00387    ClassDef(TEveWindowPack, 0); // Eve-window containing a TGPack.
00388 };
00389 
00390 
00391 //==============================================================================
00392 // TEveWindowTab
00393 //==============================================================================
00394 
00395 class TEveWindowTab : public TEveWindow
00396 {
00397 private:
00398    TEveWindowTab(const TEveWindowTab&);            // Not implemented
00399    TEveWindowTab& operator=(const TEveWindowTab&); // Not implemented
00400 
00401 protected:
00402    TGTab           *fTab;
00403 
00404 public:
00405    TEveWindowTab(TGTab* tab, const char* n="TEveWindowTab", const char* t="");
00406    virtual ~TEveWindowTab();
00407 
00408    virtual TGFrame*        GetGUIFrame();
00409 
00410    virtual Bool_t          CanMakeNewSlots() const { return kTRUE; }
00411    virtual TEveWindowSlot* NewSlot(); // *MENU*
00412 
00413    TGTab* GetTab() const { return fTab; }
00414 
00415    ClassDef(TEveWindowTab, 0); // Eve-window containing a TGTab.
00416 };
00417 
00418 #endif

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