ROOT logo
// @(#)root/gui:$Id: TGTripleSlider.h 26446 2008-11-25 11:00:24Z brun $
// Author: Bertrand Bellenot   20/01/06

/*************************************************************************
 * 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_TGTripleSlider
#define ROOT_TGTripleSlider

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGTripleVSlider and TGTripleHSlider                                  //
//                                                                      //
// TripleSlider inherit from DoubleSlider widgets and allow easy        //
// selection of a min, max and pointer value out of a range.            //
// The pointer position can be constrained to edges of slider and / or  //
// can be relative to the slider position.                              //
//                                                                      //
// To change the min value press the mouse near to the left / bottom    //
// edge of the slider.                                                  //
// To change the max value press the mouse near to the right / top      //
// edge of the slider.                                                  //
// To change both values simultaneously press the mouse near to the     //
// center of the slider.                                                //
// To change pointer value press the mouse on the pointer and drag it   //
// to the desired position                                              //
//                                                                      //
// Dragging the slider will generate the event:                         //
// kC_VSLIDER, kSL_POS, slider id, 0  (for vertical slider)             //
// kC_HSLIDER, kSL_POS, slider id, 0  (for horizontal slider)           //
//                                                                      //
// Pressing the mouse will generate the event:                          //
// kC_VSLIDER, kSL_PRESS, slider id, 0  (for vertical slider)           //
// kC_HSLIDER, kSL_PRESS, slider id, 0  (for horizontal slider)         //
//                                                                      //
// Releasing the mouse will generate the event:                         //
// kC_VSLIDER, kSL_RELEASE, slider id, 0  (for vertical slider)         //
// kC_HSLIDER, kSL_RELEASE, slider id, 0  (for horizontal slider)       //
//                                                                      //
// Moving the pointer will generate the event:                          //
// kC_VSLIDER, kSL_POINTER, slider id, 0  (for vertical slider)         //
// kC_HSLIDER, kSL_POINTER, slider id, 0  (for horizontal slider)       //
//                                                                      //
// Use the functions GetMinPosition(), GetMaxPosition() and             //
// GetPosition() to retrieve the position of the slider.                //
// Use the function GetPointerPosition() to retrieve the position of    //
// the pointer                                                          //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
#ifndef ROOT_TGWidget
#include "TGWidget.h"
#endif
#ifndef ROOT_TGDoubleSlider
#include "TGDoubleSlider.h"
#endif

class TGTripleVSlider : public TGDoubleVSlider {

protected:
   Int_t            fCz;           // vertical pointer position in pixel coordinates
   Float_t          fSCz;          // vertical pointer position
   Bool_t           fConstrained;  // kTRUE if pointer is constrained to slider edges
   Bool_t           fRelative;     // kTRUE if pointer position is relative to slider
   const TGPicture *fPointerPic;   // picture to draw pointer

   virtual void     DoRedraw();
   virtual void     SetPointerPos(Int_t z, Int_t opt = 0);

public:
   TGTripleVSlider(const TGWindow *p = 0, UInt_t h = 1, UInt_t type = 1, Int_t id = -1,
                   UInt_t options = kVerticalFrame,
                   Pixel_t back = GetDefaultFrameBackground(),
                   Bool_t reversed = kFALSE,
                   Bool_t mark_ends = kFALSE,
                   Bool_t constrained = kTRUE,
                   Bool_t relative = kFALSE);

   virtual ~TGTripleVSlider();

   virtual void      PointerPositionChanged() { Emit("PointerPositionChanged()"); } //*SIGNAL*
   virtual void      DrawPointer();
   virtual Float_t   GetPointerPosition() const {
      if (fReversedScale) return fVmin + fVmax - fSCz;
      else return fSCz;
   }
   virtual Bool_t    HandleButton(Event_t *event);
   virtual Bool_t    HandleConfigureNotify(Event_t* event);
   virtual Bool_t    HandleMotion(Event_t *event);
   virtual void      SetConstrained(Bool_t on = kTRUE);
   virtual void      SetPointerPosition(Float_t pos);
   virtual void      SetRelative(Bool_t rel = kTRUE) { fRelative = rel; }
   virtual void      SavePrimitive(ostream &out, Option_t *option = "");

   ClassDef(TGTripleVSlider,0)  // Vertical triple slider widget
};


class TGTripleHSlider : public TGDoubleHSlider {

protected:
   Int_t            fCz;           // horizontal pointer position in pixel coordinates
   Float_t          fSCz;          // vertical pointer position
   Bool_t           fConstrained;  // kTRUE if pointer is constrained to slider edges
   Bool_t           fRelative;     // kTRUE if pointer position is relative to slider
   const TGPicture *fPointerPic;   // picture to draw pointer

   virtual void     DoRedraw();
   virtual void     SetPointerPos(Int_t z, Int_t opt = 0);

public:
   TGTripleHSlider(const TGWindow *p = 0, UInt_t w = 1, UInt_t type = 1, Int_t id = -1,
                   UInt_t options = kHorizontalFrame,
                   Pixel_t back = GetDefaultFrameBackground(),
                   Bool_t reversed = kFALSE,
                   Bool_t mark_ends = kFALSE,
                   Bool_t constrained = kTRUE,
                   Bool_t relative = kFALSE);

   virtual ~TGTripleHSlider();

   virtual void      PointerPositionChanged() { Emit("PointerPositionChanged()"); } //*SIGNAL*
   virtual void      DrawPointer();
   virtual Float_t   GetPointerPosition() const {
      if (fReversedScale) return fVmin + fVmax - fSCz;
      else return fSCz;
   }
   virtual Bool_t    HandleButton(Event_t *event);
   virtual Bool_t    HandleConfigureNotify(Event_t* event);
   virtual Bool_t    HandleMotion(Event_t *event);
   virtual void      SetConstrained(Bool_t on = kTRUE);
   virtual void      SetPointerPosition(Float_t pos);
   virtual void      SetRelative(Bool_t rel = kTRUE) { fRelative = rel; }
   virtual void      SavePrimitive(ostream &out, Option_t *option = "");

   ClassDef(TGTripleHSlider,0)  // Horizontal triple slider widget
};

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