Logo ROOT   6.07/09
Reference Guide
TGedPatternSelect.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Marek Biskup, Ilka Antcheva 24/07/03
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGedPatternSelect
13 #define ROOT_TGedPatternSelect
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TGedPatternFrame, TGedPatternSelector, TGedPatternPopup //
18 // and TGedPatternColor. //
19 // //
20 // The TGedPatternFrame is a small frame with border showing a //
21 // specific pattern (fill style). //
22 // //
23 // The TGedPatternSelector is a composite frame with TGedPatternFrames //
24 // of all diferent styles //
25 // //
26 // The TGedPattern is a popup containing a TGPatternSelector. //
27 // //
28 // The TGedPatternSelect widget is a button with pattern area with //
29 // a little down arrow. When clicked on the arrow the //
30 // TGedPatternPopup pops up. //
31 // //
32 // Selecting a pattern in this widget will generate the event: //
33 // kC_PATTERNSEL, kPAT_SELCHANGED, widget id, style. //
34 // //
35 // and the signal: //
36 // PatternSelected(Style_t pattern) //
37 // //
38 // TGedSelect is button that shows popup window when clicked. //
39 // TGedPopup is a popup window. //
40 // //
41 //////////////////////////////////////////////////////////////////////////
42 
43 #ifndef ROOT_TGButton
44 #include "TGButton.h"
45 #endif
46 #ifndef ROOT_TGToolTip
47 #include "TGToolTip.h"
48 #endif
49 
50 
51 class TGedPopup : public TGCompositeFrame {
52 
53 protected:
55 
56 public:
57  TGedPopup(const TGWindow* p, const TGWindow *m, UInt_t w, UInt_t h,
58  UInt_t options = 0, Pixel_t back = GetDefaultFrameBackground());
59  virtual ~TGedPopup() { }
60 
61  virtual Bool_t HandleButton(Event_t *event);
62  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
63  void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h);
64  void EndPopup();
65 
66  ClassDef(TGedPopup,0) //popup window
67 };
68 
69 class TGedPatternFrame : public TGFrame {
70 
71 protected:
75  static TGGC *fgGC;
76  TGToolTip *fTip; // tool tip associated with a button
77  char fTipText[5];
78 
79  virtual void DoRedraw();
80 
81 public:
82  TGedPatternFrame(const TGWindow *p, Style_t pattern, Int_t width = 40,
83  Int_t height = 20);
84  virtual ~TGedPatternFrame() { delete fTip; }
85 
86  virtual Bool_t HandleButton(Event_t *event);
87  virtual Bool_t HandleCrossing(Event_t *event);
88  virtual void DrawBorder();
89 
90  void SetActive(Bool_t in) { fActive = in; gClient->NeedRedraw(this); }
91  Style_t GetPattern() const { return fPattern; }
92  static void SetFillStyle(TGGC* gc, Style_t fstyle); //set fill style for given GC
93 
94  ClassDef(TGedPatternFrame,0) //pattern frame
95 };
96 
98 
99 protected:
103 
104 public:
105  TGedPatternSelector(const TGWindow *p);
106  virtual ~TGedPatternSelector();
107 
108  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
109  void SetActive(Int_t newat);
110  Int_t GetActive() const { return fActive; }
111 
112  ClassDef(TGedPatternSelector,0) //select pattern frame
113 };
114 
115 class TGedPatternPopup : public TGedPopup {
116 
117 protected:
119 
120 public:
121  TGedPatternPopup(const TGWindow *p, const TGWindow *m, Style_t pattern);
122  virtual ~TGedPatternPopup();
123 
124  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
125 
126  ClassDef(TGedPatternPopup,0) // Color selector popup
127 };
128 
129 class TGedSelect : public TGCheckButton {
130 
131 protected:
134 
135  virtual void DoRedraw();
136  void DrawTriangle(GContext_t gc, Int_t x, Int_t y);
137 
138 public:
139  TGedSelect(const TGWindow *p, Int_t id);
140  virtual ~TGedSelect();
141 
142  virtual Bool_t HandleButton(Event_t *event);
143 
144  virtual void Enable();
145  virtual void Disable();
146  virtual void SetPopup(TGedPopup* p) { fPopup = p; } // popup will be deleted in destructor.
147 
148  ClassDef(TGedSelect,0) //selection check-button
149 };
150 
152 
153 protected:
155 
156  virtual void DoRedraw();
157 
158 public:
160  virtual ~TGedPatternSelect() {}
161 
162  void SetPattern(Style_t pattern, Bool_t emit=kTRUE);
163  Style_t GetPattern() const { return fPattern; }
164  virtual TGDimension GetDefaultSize() const { return TGDimension(55, 21); }
165  virtual void PatternSelected(Style_t pattern = 0)
166  { Emit("PatternSelected(Style_t)", pattern ? pattern : GetPattern()); } // *SIGNAL*
167  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
168  virtual void SavePrimitive(std::ostream &out, Option_t * = "");
169 
170  ClassDef(TGedPatternSelect,0) //pattern selection check-button
171 };
172 
173 #endif
short Style_t
Definition: RtypesCore.h:76
virtual ~TGedPopup()
const char Option_t
Definition: RtypesCore.h:62
TH1 * h
Definition: legend2.C:5
Style_t GetPattern() const
Handle_t GContext_t
Definition: GuiTypes.h:39
virtual void DrawBorder()
Draw frame border.
Definition: TGFrame.cxx:403
#define gClient
Definition: TGClient.h:174
virtual void PatternSelected(Style_t pattern=0)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void DoRedraw()
Redraw the frame.
Definition: TGFrame.cxx:412
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
ULong_t Pixel_t
Definition: GuiTypes.h:41
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
virtual void SetPopup(TGedPopup *p)
static const std::string pattern("pattern")
const TGWindow * fMsgWindow
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages generated by popup window.
void Emit(const char *signal)
Acitvate signal without args.
Definition: TQObject.cxx:561
void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h)
Place popup window at the specified place.
Int_t GetActive() const
TGedPopup * fPopup
a SetFillStyle(0)
const TGWindow * fMsgWindow
unsigned int UInt_t
Definition: RtypesCore.h:42
TMarker * m
Definition: textangle.C:8
Style_t GetPattern() const
virtual ~TGedPatternSelect()
void EndPopup()
Ungrab pointer and unmap popup window.
virtual TGDimension GetDefaultSize() const
default size
long Long_t
Definition: RtypesCore.h:50
void SetActive(Bool_t in)
Double_t y[n]
Definition: legend1.C:17
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a composite frame widget as a C++ statement(s) on output stream out.
Definition: TGFrame.cxx:2723
static TGGC * fgGC
virtual ~TGedPatternFrame()
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in popup window.
const Bool_t kTRUE
Definition: Rtypes.h:91
TGedPopup(const TGWindow *p, const TGWindow *m, UInt_t w, UInt_t h, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
Create a popup frame.
Definition: TGGC.h:35
virtual Bool_t HandleCrossing(Event_t *)
Definition: TGFrame.h:401
const TGWindow * fMsgWindow