TGSplitter.h

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TGSplitter.h 25229 2008-08-25 15:14:34Z bellenot $
00002 // Author: Fons Rademakers   6/09/2000
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, 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_TGSplitter
00013 #define ROOT_TGSplitter
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TGSplitter, TGVSplitter and TGHSplitter                              //
00019 //                                                                      //
00020 // A splitter allows the frames left and right or above and below of    //
00021 // it to be resized. The frame to be resized must have the kFixedWidth  //
00022 // or kFixedHeight property set.                                        //
00023 //                                                                      //
00024 //////////////////////////////////////////////////////////////////////////
00025 
00026 #ifndef ROOT_TGFrame
00027 #include "TGFrame.h"
00028 #endif
00029 
00030 
00031 class TGSplitter : public TGFrame {
00032 
00033 protected:
00034    Cursor_t    fSplitCursor;      // split cursor
00035    Bool_t      fDragging;         // true if in dragging mode
00036    Bool_t      fExternalHandler;  // true when splitter movement is handled externally
00037    const TGPicture *fSplitterPic; // picture to draw splitter
00038 
00039 private:
00040    TGSplitter(const TGSplitter&);             // not implemented
00041    TGSplitter& operator=(const TGSplitter&);  // not implemented
00042 
00043 public:
00044    TGSplitter(const TGWindow *p = 0, UInt_t w = 2, UInt_t h = 4,
00045               UInt_t options = kChildFrame,
00046               Pixel_t back = GetDefaultFrameBackground());
00047    virtual ~TGSplitter() { }
00048 
00049    virtual void   SetFrame(TGFrame *frame, Bool_t prev) = 0;
00050 
00051    virtual Bool_t HandleButton(Event_t *event) = 0;
00052    virtual Bool_t HandleMotion(Event_t *event) = 0;
00053    virtual Bool_t HandleCrossing(Event_t *event) = 0;
00054 
00055    void DragStarted();      // *SIGNAL*
00056    void Moved(Int_t delta); // *SIGNAL*
00057 
00058    Bool_t GetExternalHandler() const { return fExternalHandler; }
00059    void SetExternalHandler(Bool_t x) { fExternalHandler = x; }
00060 
00061    ClassDef(TGSplitter,0)  //A frame splitter abstract base class
00062 };
00063 
00064 
00065 class TGVSplitter : public TGSplitter {
00066 
00067 private:
00068    TGVSplitter(const TGVSplitter&);             // not implemented
00069    TGVSplitter& operator=(const TGVSplitter&);  // not implemented
00070 
00071 protected:
00072    Int_t       fStartX;         // x position when dragging starts
00073    UInt_t      fFrameWidth;     // width of frame to be resized
00074    UInt_t      fFrameHeight;    // height of frame to be resized
00075    Int_t       fMin;            // min x position frame can be resized to
00076    Int_t       fMax;            // max x position frame can be resized to
00077    TGFrame    *fFrame;          // frame that should be resized
00078    Bool_t      fLeft;           // true if frame is on the left of splitter
00079 
00080 public:
00081    TGVSplitter(const TGWindow *p = 0, UInt_t w = 4, UInt_t h = 4,
00082                UInt_t options = kChildFrame,
00083                Pixel_t back = GetDefaultFrameBackground());
00084    TGVSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
00085    virtual ~TGVSplitter();
00086 
00087    virtual void   DrawBorder();
00088    virtual void   SetFrame(TGFrame *frame, Bool_t left);
00089    const TGFrame *GetFrame() const { return fFrame; }
00090    Bool_t         GetLeft() const { return fLeft; }
00091    Bool_t         IsLeft() const { return fLeft; }
00092    virtual void   SavePrimitive(ostream &out, Option_t *option = "");
00093 
00094    virtual Bool_t HandleButton(Event_t *event);
00095    virtual Bool_t HandleMotion(Event_t *event);
00096    virtual Bool_t HandleCrossing(Event_t *event);
00097 
00098    ClassDef(TGVSplitter,0)  //A vertical frame splitter
00099 };
00100 
00101 
00102 class TGHSplitter : public TGSplitter {
00103 
00104 private:
00105    TGHSplitter(const TGHSplitter&);             // not implemented
00106    TGHSplitter& operator=(const TGHSplitter&);  // not implemented
00107 
00108 protected:
00109    Int_t       fStartY;         // y position when dragging starts
00110    UInt_t      fFrameWidth;     // width of frame to be resized
00111    UInt_t      fFrameHeight;    // height of frame to be resized
00112    Int_t       fMin;            // min y position frame can be resized to
00113    Int_t       fMax;            // max y position frame can be resized to
00114    TGFrame    *fFrame;          // frame that should be resized
00115    Bool_t      fAbove;          // true if frame is above the splitter
00116 
00117 public:
00118    TGHSplitter(const TGWindow *p = 0, UInt_t w = 4, UInt_t h = 4,
00119                UInt_t options = kChildFrame,
00120                Pixel_t back = GetDefaultFrameBackground());
00121    TGHSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
00122    virtual ~TGHSplitter();
00123 
00124    virtual void   DrawBorder();
00125    virtual void   SetFrame(TGFrame *frame, Bool_t above);
00126    const TGFrame *GetFrame() const { return fFrame; }
00127    Bool_t         GetAbove() const { return fAbove; }
00128    Bool_t         IsAbove() const { return fAbove; }
00129    virtual void   SavePrimitive(ostream &out, Option_t *option = "");
00130 
00131    virtual Bool_t HandleButton(Event_t *event);
00132    virtual Bool_t HandleMotion(Event_t *event);
00133    virtual Bool_t HandleCrossing(Event_t *event);
00134 
00135    ClassDef(TGHSplitter,0)  //A horizontal frame splitter
00136 };
00137 
00138 class TGVFileSplitter : public TGVSplitter {
00139 
00140 public:
00141    TGVFileSplitter(const TGWindow *p = 0, UInt_t w = 4, UInt_t h = 4,
00142                UInt_t options = kChildFrame,
00143                Pixel_t back = GetDefaultFrameBackground());
00144    virtual ~TGVFileSplitter();
00145 
00146    virtual Bool_t HandleDoubleClick(Event_t *);
00147    virtual Bool_t HandleButton(Event_t *event);
00148    virtual Bool_t HandleMotion(Event_t *event);
00149    virtual void   SavePrimitive(ostream &out, Option_t *option = "");
00150 
00151    void LayoutHeader(TGFrame *f);  //*SIGNAL*
00152    void LayoutListView();  //*SIGNAL*
00153    void ButtonPressed();   //*SIGNAL*
00154    void ButtonReleased();  //*SIGNAL*
00155    void DoubleClicked(TGVFileSplitter* frame);  //*SIGNAL*
00156 
00157    ClassDef(TGVFileSplitter,0)  //A vertical file frame splitter
00158 };
00159 
00160 
00161 #endif

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