Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGDockableFrame.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gui:$Id$
0002 // Author: Abdelhalim Ssadik   07/07/04
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGDockableFrame
0013 #define ROOT_TGDockableFrame
0014 
0015 
0016 #include "TGFrame.h"
0017 
0018 #include "TGWidget.h"
0019 
0020 #include "TGButton.h"
0021 
0022 #include "TGWindow.h"
0023 
0024 
0025 class TGDockableFrame;
0026 
0027 
0028 class TGDockButton : public TGButton {
0029 protected:
0030    Bool_t     fMouseOn;    ///< true when mouse on button
0031    ULong_t    fNormBg;     ///< normal background color
0032    ULong_t    fHiBg;       ///< highlighted background color
0033 
0034    void DrawBorder() override;
0035    void DoRedraw() override;
0036 
0037 public:
0038    TGDockButton(const TGCompositeFrame *p = nullptr, Int_t id = 1);
0039    ~TGDockButton() override;
0040 
0041    Bool_t HandleCrossing(Event_t *event) override;
0042 
0043    ClassDefOverride(TGDockButton,0)  // Dock button
0044 };
0045 
0046 
0047 class TGDockHideButton : public TGDockButton {
0048 protected:
0049    Int_t     fAspectRatio;   ///< triangle orientation
0050 
0051    void DoRedraw() override;
0052 
0053 public:
0054    TGDockHideButton(const TGCompositeFrame *p = nullptr);
0055 
0056    void SetAspectRatio(Int_t a) { fAspectRatio = a; DoRedraw(); }
0057 
0058    ClassDefOverride(TGDockHideButton,0)  // Hide dock button
0059 };
0060 
0061 
0062 class TGUndockedFrame : public TGTransientFrame {
0063 
0064 private:
0065    TGUndockedFrame(const TGUndockedFrame&) = delete;
0066    TGUndockedFrame& operator=(const TGUndockedFrame&) = delete;
0067 
0068 protected:
0069    TGDockableFrame    *fDockable;   ///< orignal dockable frame
0070 
0071 public:
0072    TGUndockedFrame(const TGWindow *p = nullptr, TGDockableFrame *dockable = nullptr);
0073    ~TGUndockedFrame() override;
0074 
0075    void FixSize();
0076    void CloseWindow() override;
0077 
0078    ClassDefOverride(TGUndockedFrame,0)  // Undocked frame
0079 };
0080 
0081 
0082 class TGDockableFrame : public TGCompositeFrame, public TGWidget {
0083 friend class TGUndockedFrame;
0084 
0085 private:
0086    TGDockableFrame(const TGDockableFrame&) = delete;
0087    TGDockableFrame& operator=(const TGDockableFrame&) = delete;
0088 
0089 protected:
0090    Bool_t            fHidden;        ///< if frame is hidden
0091    Bool_t            fEnableHide;    ///< if frame can be hidden
0092    Bool_t            fEnableUndock;  ///< if frame can be undocked
0093    Bool_t            fDeleted;       ///< kTRUE if it is being deleted
0094    Bool_t            fFixedSize;     ///< kTRUE if fixed size when undocked
0095    TString           fDockName;      ///< name of frame
0096    TGCompositeFrame *fContainer;     ///< container containing dockable frame
0097    TGCompositeFrame *fButtons;       ///< container containing dock and hide buttons
0098    TGDockButton     *fDockButton;    ///< dock button
0099    TGDockHideButton *fHideButton;    ///< hide button
0100    TGUndockedFrame  *fFrame;         ///< undocked frame
0101    TGLayoutHints    *fHints;         ///< layout hints
0102    TGLayoutHints    *fLb, *fLc;      ///< layout hints
0103 
0104 public:
0105    TGDockableFrame(const TGWindow *p = nullptr, Int_t id = -1,
0106                    UInt_t options = kHorizontalFrame);
0107    ~TGDockableFrame() override;
0108 
0109    void AddFrame(TGFrame *f, TGLayoutHints *hints) override;
0110 
0111    Bool_t ProcessMessage(Longptr_t, Longptr_t, Longptr_t) override;
0112    virtual void Docked() { Emit("Docked()"); }        //*SIGNAL*
0113    virtual void Undocked() { Emit("Undocked()"); }    //*SIGNAL*
0114 
0115    void UndockContainer();
0116    void DockContainer(Int_t del = kTRUE);
0117 
0118    void HideContainer();
0119    void ShowContainer();
0120 
0121    void   EnableUndock(Bool_t onoff);
0122    Bool_t EnableUndock() const { return fEnableUndock; }
0123    void   EnableHide(Bool_t onoff);
0124    Bool_t EnableHide() const { return fEnableHide; }
0125 
0126    void SetWindowName(const char *name) override;
0127 
0128    Bool_t IsUndocked() const { return fFrame != nullptr; }
0129    Bool_t IsHidden() const { return fHidden; }
0130 
0131    Bool_t IsFixedSize() const { return  fFixedSize; }
0132    void   SetFixedSize(Bool_t fixed) { fFixedSize = fixed; }
0133 
0134    TGCompositeFrame *GetContainer() const { return fContainer; }
0135    TGUndockedFrame  *GetUndocked() const { return fFrame; }
0136 
0137    void      SavePrimitive(std::ostream &out, Option_t *option = "") override;
0138 
0139    ClassDefOverride(TGDockableFrame,0)  // Dockable widget
0140 };
0141 
0142 #endif