// @(#)root/gui:$Id$
// Author: Fons Rademakers   18/9/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_TGShutter
#define ROOT_TGShutter


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGShutter, TGShutterItem                                             //
//                                                                      //
// A shutter widget contains a set of shutter items that can be         //
// open and closed like a shutter.                                      //
// This widget is usefull to group a large number of options in         //
// a number of categories.                                              //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
#ifndef ROOT_TGCanvas
#include "TGCanvas.h"
#endif
#ifndef ROOT_TGWidget
#include "TGWidget.h"
#endif


class TGButton;
class TGCanvas;
class TTimer;
class TList;



class TGShutterItem : public TGVerticalFrame, public TGWidget {

friend class TGShutter;

protected:
   TGButton      *fButton;     // shutter item button
   TGCanvas      *fCanvas;     // canvas of shutter item
   TGFrame       *fContainer;  // container in canvas containing shutter items
   TGLayoutHints *fL1, *fL2;   // positioning hints

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

public:
   TGShutterItem(const TGWindow *p = 0, TGHotString *s = 0, Int_t id = -1,
                 UInt_t options = 0);
   virtual ~TGShutterItem();

   TGButton *GetButton() const { return fButton; }
   TGFrame  *GetContainer() const { return fCanvas->GetContainer(); }
   virtual void Selected()  { Emit(" Selected()"); } //*SIGNAL*

   virtual void SavePrimitive(std::ostream &out, Option_t *option = "");

   ClassDef(TGShutterItem,0)  // Shutter widget item
};



class TGShutter : public TGCompositeFrame {

protected:
   TTimer         *fTimer;                  // Timer for animation
   TGShutterItem  *fSelectedItem;           // Item currently open
   TGShutterItem  *fClosingItem;            // Item closing down
   TList          *fTrash;                  // Items that need to be cleaned up
   Int_t           fHeightIncrement;        // Height delta
   Int_t           fClosingHeight;          // Closing items current height
   Int_t           fClosingHadScrollbar;    // Closing item had a scroll bar
   UInt_t          fDefWidth;               // Default width
   UInt_t          fDefHeight;              // Default height

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

public:
   TGShutter(const TGWindow *p = 0, UInt_t options = kSunkenFrame);
   virtual ~TGShutter();

   virtual void   AddItem(TGShutterItem *item);
   virtual void   RemoveItem(const char *name);
   virtual TGShutterItem *AddPage(const char *item = "Page"); //*MENU*
   virtual void   RemovePage();                    //*MENU*
   virtual void   RenamePage(const char *name);    //*MENU*
   virtual Bool_t HandleTimer(TTimer *t);
   virtual void   Layout();
   virtual void   SetLayoutManager(TGLayoutManager*) { }
   TGShutterItem *GetSelectedItem() const { return fSelectedItem; }
   TGShutterItem *GetItem(const char *name);
   virtual void   SetSelectedItem(TGShutterItem *item);
   virtual void   SetSelectedItem(const char *name);
   virtual void   EnableItem(const char *name, Bool_t on = kTRUE);

   virtual TGDimension GetDefaultSize() const;
   virtual void        SetDefaultSize(UInt_t w, UInt_t h);

   virtual void   SavePrimitive(std::ostream &out, Option_t *option = "");

   virtual Bool_t ProcessMessage(Long_t cmd, Long_t parm1, Long_t parm2);
   virtual void   Selected(TGShutterItem *item) { Emit(" Selected(TGShutterItem*)", item); } //*SIGNAL*

   ClassDef(TGShutter,0)  // Shutter widget
};

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