TGShutter.h

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TGShutter.h 32706 2010-03-23 07:54:10Z bellenot $
00002 // Author: Fons Rademakers   18/9/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_TGShutter
00013 #define ROOT_TGShutter
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TGShutter, TGShutterItem                                             //
00019 //                                                                      //
00020 // A shutter widget contains a set of shutter items that can be         //
00021 // open and closed like a shutter.                                      //
00022 // This widget is usefull to group a large number of options in         //
00023 // a number of categories.                                              //
00024 //                                                                      //
00025 //////////////////////////////////////////////////////////////////////////
00026 
00027 #ifndef ROOT_TGFrame
00028 #include "TGFrame.h"
00029 #endif
00030 #ifndef ROOT_TGCanvas
00031 #include "TGCanvas.h"
00032 #endif
00033 #ifndef ROOT_TGWidget
00034 #include "TGWidget.h"
00035 #endif
00036 
00037 
00038 class TGButton;
00039 class TGCanvas;
00040 class TTimer;
00041 class TList;
00042 
00043 
00044 
00045 class TGShutterItem : public TGVerticalFrame, public TGWidget {
00046 
00047 friend class TGShutter;
00048 
00049 protected:
00050    TGButton      *fButton;     // shutter item button
00051    TGCanvas      *fCanvas;     // canvas of shutter item
00052    TGFrame       *fContainer;  // container in canvas containing shutter items
00053    TGLayoutHints *fL1, *fL2;   // positioning hints
00054 
00055 private:
00056    TGShutterItem(const TGShutterItem&);              // not implemented
00057    TGShutterItem& operator=(const TGShutterItem&);   // not implemented
00058 
00059 public:
00060    TGShutterItem(const TGWindow *p = 0, TGHotString *s = 0, Int_t id = -1,
00061                  UInt_t options = 0);
00062    virtual ~TGShutterItem();
00063 
00064    TGButton *GetButton() const { return fButton; }
00065    TGFrame  *GetContainer() const { return fCanvas->GetContainer(); }
00066    virtual void Selected()  { Emit(" Selected()"); } //*SIGNAL*
00067 
00068    virtual void SavePrimitive(ostream &out, Option_t *option = "");
00069 
00070    ClassDef(TGShutterItem,0)  // Shutter widget item
00071 };
00072 
00073 
00074 
00075 class TGShutter : public TGCompositeFrame {
00076 
00077 protected:
00078    TTimer         *fTimer;                  // Timer for animation
00079    TGShutterItem  *fSelectedItem;           // Item currently open
00080    TGShutterItem  *fClosingItem;            // Item closing down
00081    TList          *fTrash;                  // Items that need to be cleaned up
00082    Int_t           fHeightIncrement;        // Height delta
00083    Int_t           fClosingHeight;          // Closing items current height
00084    Int_t           fClosingHadScrollbar;    // Closing item had a scroll bar
00085    UInt_t          fDefWidth;               // Default width
00086    UInt_t          fDefHeight;              // Default height
00087 
00088 private:
00089    TGShutter(const TGShutter&);             // not implemented
00090    TGShutter& operator=(const TGShutter&);  // not implemented
00091 
00092 public:
00093    TGShutter(const TGWindow *p = 0, UInt_t options = kSunkenFrame);
00094    virtual ~TGShutter();
00095 
00096    virtual void   AddItem(TGShutterItem *item);
00097    virtual void   RemoveItem(const char *name);
00098    virtual TGShutterItem *AddPage(const char *item = "Page"); //*MENU*
00099    virtual void   RemovePage();                    //*MENU*
00100    virtual void   RenamePage(const char *name);    //*MENU*
00101    virtual Bool_t HandleTimer(TTimer *t);
00102    virtual void   Layout();
00103    virtual void   SetLayoutManager(TGLayoutManager*) { }
00104    TGShutterItem *GetSelectedItem() const { return fSelectedItem; }
00105    TGShutterItem *GetItem(const char *name);
00106    virtual void   SetSelectedItem(TGShutterItem *item);
00107    virtual void   SetSelectedItem(const char *name);
00108    virtual void   EnableItem(const char *name, Bool_t on = kTRUE);
00109 
00110    virtual TGDimension GetDefaultSize() const;
00111    virtual void        SetDefaultSize(UInt_t w, UInt_t h);
00112 
00113    virtual void   SavePrimitive(ostream &out, Option_t *option = "");
00114 
00115    virtual Bool_t ProcessMessage(Long_t cmd, Long_t parm1, Long_t parm2);
00116    virtual void   Selected(TGShutterItem *item) { Emit(" Selected(TGShutterItem*)", item); } //*SIGNAL*
00117 
00118    ClassDef(TGShutter,0)  // Shutter widget
00119 };
00120 
00121 #endif

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