// @(#)root/gui:$Id$
// Author: Fons Rademakers   6/09/2000

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGSplitter
#define ROOT_TGSplitter


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGSplitter, TGVSplitter and TGHSplitter                              //
//                                                                      //
// A splitter allows the frames left and right or above and below of    //
// it to be resized. The frame to be resized must have the kFixedWidth  //
// or kFixedHeight property set.                                        //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif


class TGSplitter : public TGFrame {

protected:
   Cursor_t    fSplitCursor;      // split cursor
   Bool_t      fDragging;         // true if in dragging mode
   Bool_t      fExternalHandler;  // true when splitter movement is handled externally
   const TGPicture *fSplitterPic; // picture to draw splitter

private:
   TGSplitter(const TGSplitter&);             // not implemented
   TGSplitter& operator=(const TGSplitter&);  // not implemented

public:
   TGSplitter(const TGWindow *p = 0, UInt_t w = 2, UInt_t h = 4,
              UInt_t options = kChildFrame,
              Pixel_t back = GetDefaultFrameBackground());
   virtual ~TGSplitter() { }

   virtual void   SetFrame(TGFrame *frame, Bool_t prev) = 0;

   virtual Bool_t HandleButton(Event_t *event) = 0;
   virtual Bool_t HandleMotion(Event_t *event) = 0;
   virtual Bool_t HandleCrossing(Event_t *event) = 0;

   void DragStarted();      // *SIGNAL*
   void Moved(Int_t delta); // *SIGNAL*

   Bool_t GetExternalHandler() const { return fExternalHandler; }
   void SetExternalHandler(Bool_t x) { fExternalHandler = x; }

   ClassDef(TGSplitter,0)  //A frame splitter abstract base class
};


class TGVSplitter : public TGSplitter {

private:
   TGVSplitter(const TGVSplitter&);             // not implemented
   TGVSplitter& operator=(const TGVSplitter&);  // not implemented

protected:
   Int_t       fStartX;         // x position when dragging starts
   UInt_t      fFrameWidth;     // width of frame to be resized
   UInt_t      fFrameHeight;    // height of frame to be resized
   Int_t       fMin;            // min x position frame can be resized to
   Int_t       fMax;            // max x position frame can be resized to
   TGFrame    *fFrame;          // frame that should be resized
   Bool_t      fLeft;           // true if frame is on the left of splitter

public:
   TGVSplitter(const TGWindow *p = 0, UInt_t w = 4, UInt_t h = 4,
               UInt_t options = kChildFrame,
               Pixel_t back = GetDefaultFrameBackground());
   TGVSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
   virtual ~TGVSplitter();

   virtual void   DrawBorder();
   virtual void   SetFrame(TGFrame *frame, Bool_t left);
   const TGFrame *GetFrame() const { return fFrame; }
   Bool_t         GetLeft() const { return fLeft; }
   Bool_t         IsLeft() const { return fLeft; }
   virtual void   SavePrimitive(std::ostream &out, Option_t *option = "");

   virtual Bool_t HandleButton(Event_t *event);
   virtual Bool_t HandleMotion(Event_t *event);
   virtual Bool_t HandleCrossing(Event_t *event);

   ClassDef(TGVSplitter,0)  //A vertical frame splitter
};


class TGHSplitter : public TGSplitter {

private:
   TGHSplitter(const TGHSplitter&);             // not implemented
   TGHSplitter& operator=(const TGHSplitter&);  // not implemented

protected:
   Int_t       fStartY;         // y position when dragging starts
   UInt_t      fFrameWidth;     // width of frame to be resized
   UInt_t      fFrameHeight;    // height of frame to be resized
   Int_t       fMin;            // min y position frame can be resized to
   Int_t       fMax;            // max y position frame can be resized to
   TGFrame    *fFrame;          // frame that should be resized
   Bool_t      fAbove;          // true if frame is above the splitter

public:
   TGHSplitter(const TGWindow *p = 0, UInt_t w = 4, UInt_t h = 4,
               UInt_t options = kChildFrame,
               Pixel_t back = GetDefaultFrameBackground());
   TGHSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
   virtual ~TGHSplitter();

   virtual void   DrawBorder();
   virtual void   SetFrame(TGFrame *frame, Bool_t above);
   const TGFrame *GetFrame() const { return fFrame; }
   Bool_t         GetAbove() const { return fAbove; }
   Bool_t         IsAbove() const { return fAbove; }
   virtual void   SavePrimitive(std::ostream &out, Option_t *option = "");

   virtual Bool_t HandleButton(Event_t *event);
   virtual Bool_t HandleMotion(Event_t *event);
   virtual Bool_t HandleCrossing(Event_t *event);

   ClassDef(TGHSplitter,0)  //A horizontal frame splitter
};

class TGVFileSplitter : public TGVSplitter {

public:
   TGVFileSplitter(const TGWindow *p = 0, UInt_t w = 4, UInt_t h = 4,
               UInt_t options = kChildFrame,
               Pixel_t back = GetDefaultFrameBackground());
   virtual ~TGVFileSplitter();

   virtual Bool_t HandleDoubleClick(Event_t *);
   virtual Bool_t HandleButton(Event_t *event);
   virtual Bool_t HandleMotion(Event_t *event);
   virtual void   SavePrimitive(std::ostream &out, Option_t *option = "");

   void LayoutHeader(TGFrame *f);  //*SIGNAL*
   void LayoutListView();  //*SIGNAL*
   void ButtonPressed();   //*SIGNAL*
   void ButtonReleased();  //*SIGNAL*
   void DoubleClicked(TGVFileSplitter* frame);  //*SIGNAL*

   ClassDef(TGVFileSplitter,0)  //A vertical file frame splitter
};


#endif
 TGSplitter.h:1
 TGSplitter.h:2
 TGSplitter.h:3
 TGSplitter.h:4
 TGSplitter.h:5
 TGSplitter.h:6
 TGSplitter.h:7
 TGSplitter.h:8
 TGSplitter.h:9
 TGSplitter.h:10
 TGSplitter.h:11
 TGSplitter.h:12
 TGSplitter.h:13
 TGSplitter.h:14
 TGSplitter.h:15
 TGSplitter.h:16
 TGSplitter.h:17
 TGSplitter.h:18
 TGSplitter.h:19
 TGSplitter.h:20
 TGSplitter.h:21
 TGSplitter.h:22
 TGSplitter.h:23
 TGSplitter.h:24
 TGSplitter.h:25
 TGSplitter.h:26
 TGSplitter.h:27
 TGSplitter.h:28
 TGSplitter.h:29
 TGSplitter.h:30
 TGSplitter.h:31
 TGSplitter.h:32
 TGSplitter.h:33
 TGSplitter.h:34
 TGSplitter.h:35
 TGSplitter.h:36
 TGSplitter.h:37
 TGSplitter.h:38
 TGSplitter.h:39
 TGSplitter.h:40
 TGSplitter.h:41
 TGSplitter.h:42
 TGSplitter.h:43
 TGSplitter.h:44
 TGSplitter.h:45
 TGSplitter.h:46
 TGSplitter.h:47
 TGSplitter.h:48
 TGSplitter.h:49
 TGSplitter.h:50
 TGSplitter.h:51
 TGSplitter.h:52
 TGSplitter.h:53
 TGSplitter.h:54
 TGSplitter.h:55
 TGSplitter.h:56
 TGSplitter.h:57
 TGSplitter.h:58
 TGSplitter.h:59
 TGSplitter.h:60
 TGSplitter.h:61
 TGSplitter.h:62
 TGSplitter.h:63
 TGSplitter.h:64
 TGSplitter.h:65
 TGSplitter.h:66
 TGSplitter.h:67
 TGSplitter.h:68
 TGSplitter.h:69
 TGSplitter.h:70
 TGSplitter.h:71
 TGSplitter.h:72
 TGSplitter.h:73
 TGSplitter.h:74
 TGSplitter.h:75
 TGSplitter.h:76
 TGSplitter.h:77
 TGSplitter.h:78
 TGSplitter.h:79
 TGSplitter.h:80
 TGSplitter.h:81
 TGSplitter.h:82
 TGSplitter.h:83
 TGSplitter.h:84
 TGSplitter.h:85
 TGSplitter.h:86
 TGSplitter.h:87
 TGSplitter.h:88
 TGSplitter.h:89
 TGSplitter.h:90
 TGSplitter.h:91
 TGSplitter.h:92
 TGSplitter.h:93
 TGSplitter.h:94
 TGSplitter.h:95
 TGSplitter.h:96
 TGSplitter.h:97
 TGSplitter.h:98
 TGSplitter.h:99
 TGSplitter.h:100
 TGSplitter.h:101
 TGSplitter.h:102
 TGSplitter.h:103
 TGSplitter.h:104
 TGSplitter.h:105
 TGSplitter.h:106
 TGSplitter.h:107
 TGSplitter.h:108
 TGSplitter.h:109
 TGSplitter.h:110
 TGSplitter.h:111
 TGSplitter.h:112
 TGSplitter.h:113
 TGSplitter.h:114
 TGSplitter.h:115
 TGSplitter.h:116
 TGSplitter.h:117
 TGSplitter.h:118
 TGSplitter.h:119
 TGSplitter.h:120
 TGSplitter.h:121
 TGSplitter.h:122
 TGSplitter.h:123
 TGSplitter.h:124
 TGSplitter.h:125
 TGSplitter.h:126
 TGSplitter.h:127
 TGSplitter.h:128
 TGSplitter.h:129
 TGSplitter.h:130
 TGSplitter.h:131
 TGSplitter.h:132
 TGSplitter.h:133
 TGSplitter.h:134
 TGSplitter.h:135
 TGSplitter.h:136
 TGSplitter.h:137
 TGSplitter.h:138
 TGSplitter.h:139
 TGSplitter.h:140
 TGSplitter.h:141
 TGSplitter.h:142
 TGSplitter.h:143
 TGSplitter.h:144
 TGSplitter.h:145
 TGSplitter.h:146
 TGSplitter.h:147
 TGSplitter.h:148
 TGSplitter.h:149
 TGSplitter.h:150
 TGSplitter.h:151
 TGSplitter.h:152
 TGSplitter.h:153
 TGSplitter.h:154
 TGSplitter.h:155
 TGSplitter.h:156
 TGSplitter.h:157
 TGSplitter.h:158
 TGSplitter.h:159
 TGSplitter.h:160
 TGSplitter.h:161