TGedPatternSelect.h

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TGedPatternSelect.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Marek Biskup, Ilka Antcheva   24/07/03
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2002, 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_TGedPatternSelect
00013 #define ROOT_TGedPatternSelect
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TGedPatternFrame, TGedPatternSelector, TGedPatternPopup              //
00018 // and TGedPatternColor.                                                //
00019 //                                                                      //
00020 // The TGedPatternFrame is a small frame with border showing a          //
00021 // specific pattern (fill style).                                       //
00022 //                                                                      //
00023 // The TGedPatternSelector is a composite frame with TGedPatternFrames  //
00024 // of all diferent styles                                               //
00025 //                                                                      //
00026 // The TGedPattern is a popup containing a TGPatternSelector.           //
00027 //                                                                      //
00028 // The TGedPatternSelect widget is a button with pattern area with      //
00029 // a little down arrow. When clicked on the arrow the                   //
00030 // TGedPatternPopup pops up.                                            //
00031 //                                                                      //
00032 // Selecting a pattern in this widget will generate the event:          //
00033 // kC_PATTERNSEL, kPAT_SELCHANGED, widget id, style.                    //
00034 //                                                                      //
00035 // and the signal:                                                      //
00036 // PatternSelected(Style_t pattern)                                     //
00037 //                                                                      //
00038 // TGedSelect is button that shows popup window when clicked.           //
00039 // TGedPopup is a popup window.                                         //
00040 //                                                                      //
00041 //////////////////////////////////////////////////////////////////////////
00042 
00043 #ifndef ROOT_TGButton
00044 #include "TGButton.h"
00045 #endif
00046 #ifndef ROOT_TGToolTip
00047 #include "TGToolTip.h"
00048 #endif
00049 
00050 
00051 class TGedPopup : public TGCompositeFrame {
00052 
00053 protected:
00054    const TGWindow  *fMsgWindow;
00055 
00056 public:
00057    TGedPopup(const TGWindow* p, const TGWindow *m, UInt_t w, UInt_t h,
00058              UInt_t options = 0, Pixel_t back = GetDefaultFrameBackground());
00059    virtual ~TGedPopup() { }
00060 
00061    virtual Bool_t HandleButton(Event_t *event);
00062    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00063    void           PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h);
00064    void           EndPopup();
00065 
00066    ClassDef(TGedPopup,0)  //popup window
00067 };
00068 
00069 class TGedPatternFrame : public TGFrame {
00070 
00071 protected:
00072    const TGWindow *fMsgWindow;
00073    Bool_t          fActive;
00074    Style_t         fPattern;
00075    static TGGC    *fgGC;
00076    TGToolTip      *fTip;         // tool tip associated with a button
00077    char            fTipText[5];
00078 
00079    virtual void    DoRedraw();
00080 
00081 public:
00082    TGedPatternFrame(const TGWindow *p, Style_t pattern, Int_t width = 40,
00083                     Int_t height = 20);
00084    virtual ~TGedPatternFrame() { delete fTip; }
00085 
00086    virtual Bool_t  HandleButton(Event_t *event);
00087    virtual Bool_t  HandleCrossing(Event_t *event);
00088    virtual void    DrawBorder();
00089 
00090    void            SetActive(Bool_t in) { fActive = in; gClient->NeedRedraw(this); }
00091    Style_t         GetPattern() const { return fPattern; }
00092    static void     SetFillStyle(TGGC* gc, Style_t fstyle); //set fill style for given GC
00093 
00094    ClassDef(TGedPatternFrame,0)  //pattern frame
00095 };
00096 
00097 class TGedPatternSelector : public TGCompositeFrame {
00098 
00099 protected:
00100    Int_t              fActive;
00101    const TGWindow    *fMsgWindow;
00102    TGedPatternFrame  *fCe[27];
00103 
00104 public:
00105    TGedPatternSelector(const TGWindow *p);
00106    virtual ~TGedPatternSelector();
00107 
00108    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00109    void           SetActive(Int_t newat);
00110    Int_t          GetActive() const { return fActive; }
00111 
00112    ClassDef(TGedPatternSelector,0)  //select pattern frame
00113 };
00114 
00115 class TGedPatternPopup : public TGedPopup {
00116 
00117 protected:
00118    Style_t  fCurrentPattern;
00119 
00120 public:
00121    TGedPatternPopup(const TGWindow *p, const TGWindow *m, Style_t pattern);
00122    virtual ~TGedPatternPopup();
00123 
00124    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00125 
00126    ClassDef(TGedPatternPopup,0)  // Color selector popup
00127 };
00128 
00129 class TGedSelect : public TGCheckButton {
00130 
00131 protected:
00132    TGGC           *fDrawGC;
00133    TGedPopup      *fPopup;
00134 
00135    virtual void   DoRedraw();
00136    void           DrawTriangle(GContext_t gc, Int_t x, Int_t y);
00137 
00138 public:
00139    TGedSelect(const TGWindow *p, Int_t id);
00140    virtual ~TGedSelect();
00141 
00142    virtual Bool_t HandleButton(Event_t *event);
00143 
00144    virtual void   Enable();
00145    virtual void   Disable();
00146    virtual void   SetPopup(TGedPopup* p) { fPopup = p; }  // popup will be deleted in destructor.
00147 
00148    ClassDef(TGedSelect,0)  //selection check-button
00149 };
00150 
00151 class TGedPatternSelect : public TGedSelect {
00152 
00153 protected:
00154    Style_t      fPattern;
00155 
00156    virtual void DoRedraw();
00157 
00158 public:
00159    TGedPatternSelect(const TGWindow *p, Style_t pattern, Int_t id);
00160    virtual ~TGedPatternSelect() {}
00161 
00162    void           SetPattern(Style_t pattern, Bool_t emit=kTRUE);
00163    Style_t        GetPattern() const { return fPattern; }
00164    virtual        TGDimension GetDefaultSize() const { return TGDimension(55, 21); }
00165    virtual void   PatternSelected(Style_t pattern = 0) 
00166                   { Emit("PatternSelected(Style_t)", pattern ? pattern : GetPattern()); }  // *SIGNAL*
00167    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00168    virtual void   SavePrimitive(ostream &out, Option_t * = "");
00169 
00170    ClassDef(TGedPatternSelect,0)  //pattern selection check-button
00171 };
00172 
00173 #endif

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