Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGSplitter.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: Fons Rademakers   6/09/2000
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_TGSplitter
0013 #define ROOT_TGSplitter
0014 
0015 
0016 #include "TGFrame.h"
0017 
0018 
0019 class TGSplitter : public TGFrame {
0020 
0021 protected:
0022    Cursor_t    fSplitCursor;      ///< split cursor
0023    Bool_t      fDragging;         ///< true if in dragging mode
0024    Bool_t      fExternalHandler;  ///< true when splitter movement is handled externally
0025    const TGPicture *fSplitterPic; ///< picture to draw splitter
0026 
0027 private:
0028    TGSplitter(const TGSplitter&) = delete;
0029    TGSplitter& operator=(const TGSplitter&) = delete;
0030 
0031 public:
0032    TGSplitter(const TGWindow *p = nullptr, UInt_t w = 2, UInt_t h = 4,
0033               UInt_t options = kChildFrame,
0034               Pixel_t back = GetDefaultFrameBackground());
0035    ~TGSplitter() override { }
0036 
0037    virtual void   SetFrame(TGFrame *frame, Bool_t prev) = 0;
0038 
0039    Bool_t HandleButton(Event_t *event) override = 0;
0040    Bool_t HandleMotion(Event_t *event) override = 0;
0041    Bool_t HandleCrossing(Event_t *event) override = 0;
0042 
0043    void DragStarted();      // *SIGNAL*
0044    void Moved(Int_t delta); // *SIGNAL*
0045 
0046    Bool_t GetExternalHandler() const { return fExternalHandler; }
0047    void SetExternalHandler(Bool_t x) { fExternalHandler = x; }
0048 
0049    ClassDefOverride(TGSplitter,0)  //A frame splitter abstract base class
0050 };
0051 
0052 
0053 class TGVSplitter : public TGSplitter {
0054 
0055 private:
0056    TGVSplitter(const TGVSplitter&) = delete;
0057    TGVSplitter& operator=(const TGVSplitter&) = delete;
0058 
0059 protected:
0060    Int_t       fStartX;         ///< x position when dragging starts
0061    UInt_t      fFrameWidth;     ///< width of frame to be resized
0062    UInt_t      fFrameHeight;    ///< height of frame to be resized
0063    Int_t       fMin;            ///< min x position frame can be resized to
0064    Int_t       fMax;            ///< max x position frame can be resized to
0065    TGFrame    *fFrame;          ///< frame that should be resized
0066    Bool_t      fLeft;           ///< true if frame is on the left of splitter
0067 
0068 public:
0069    TGVSplitter(const TGWindow *p = nullptr, UInt_t w = 4, UInt_t h = 4,
0070                UInt_t options = kChildFrame,
0071                Pixel_t back = GetDefaultFrameBackground());
0072    TGVSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
0073    ~TGVSplitter() override;
0074 
0075    void           DrawBorder() override;
0076    void           SetFrame(TGFrame *frame, Bool_t left) override;
0077    const TGFrame *GetFrame() const { return fFrame; }
0078    Bool_t         GetLeft() const { return fLeft; }
0079    Bool_t         IsLeft() const { return fLeft; }
0080    void           SavePrimitive(std::ostream &out, Option_t *option = "") override;
0081 
0082    Bool_t HandleButton(Event_t *event) override;
0083    Bool_t HandleMotion(Event_t *event) override;
0084    Bool_t HandleCrossing(Event_t *event) override;
0085 
0086    ClassDefOverride(TGVSplitter,0)  //A vertical frame splitter
0087 };
0088 
0089 
0090 class TGHSplitter : public TGSplitter {
0091 
0092 private:
0093    TGHSplitter(const TGHSplitter&) = delete;
0094    TGHSplitter& operator=(const TGHSplitter&) = delete;
0095 
0096 protected:
0097    Int_t       fStartY;         ///< y position when dragging starts
0098    UInt_t      fFrameWidth;     ///< width of frame to be resized
0099    UInt_t      fFrameHeight;    ///< height of frame to be resized
0100    Int_t       fMin;            ///< min y position frame can be resized to
0101    Int_t       fMax;            ///< max y position frame can be resized to
0102    TGFrame    *fFrame;          ///< frame that should be resized
0103    Bool_t      fAbove;          ///< true if frame is above the splitter
0104 
0105 public:
0106    TGHSplitter(const TGWindow *p = nullptr, UInt_t w = 4, UInt_t h = 4,
0107                UInt_t options = kChildFrame,
0108                Pixel_t back = GetDefaultFrameBackground());
0109    TGHSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
0110    ~TGHSplitter() override;
0111 
0112    void           DrawBorder() override;
0113    void           SetFrame(TGFrame *frame, Bool_t above) override;
0114    const TGFrame *GetFrame() const { return fFrame; }
0115    Bool_t         GetAbove() const { return fAbove; }
0116    Bool_t         IsAbove() const { return fAbove; }
0117    void   SavePrimitive(std::ostream &out, Option_t *option = "") override;
0118 
0119    Bool_t HandleButton(Event_t *event) override;
0120    Bool_t HandleMotion(Event_t *event) override;
0121    Bool_t HandleCrossing(Event_t *event) override;
0122 
0123    ClassDefOverride(TGHSplitter,0)  //A horizontal frame splitter
0124 };
0125 
0126 class TGVFileSplitter : public TGVSplitter {
0127 
0128 private:
0129    TGVFileSplitter(const TGVFileSplitter&) = delete;
0130    TGVFileSplitter& operator=(const TGVFileSplitter&) = delete;
0131 
0132 public:
0133    TGVFileSplitter(const TGWindow *p = nullptr, UInt_t w = 4, UInt_t h = 4,
0134                UInt_t options = kChildFrame,
0135                Pixel_t back = GetDefaultFrameBackground());
0136    ~TGVFileSplitter() override;
0137 
0138    Bool_t HandleDoubleClick(Event_t *) override;
0139    Bool_t HandleButton(Event_t *event) override;
0140    Bool_t HandleMotion(Event_t *event) override;
0141    void   SavePrimitive(std::ostream &out, Option_t *option = "") override;
0142 
0143    void LayoutHeader(TGFrame *f);  //*SIGNAL*
0144    void LayoutListView();  //*SIGNAL*
0145    void ButtonPressed();   //*SIGNAL*
0146    void ButtonReleased();  //*SIGNAL*
0147    void DoubleClicked(TGVFileSplitter* frame);  //*SIGNAL*
0148 
0149    ClassDefOverride(TGVFileSplitter,0)  //A vertical file frame splitter
0150 };
0151 
0152 
0153 #endif