Logo ROOT   6.14/05
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 #include "TGButton.h"
44 #include "TGToolTip.h"
45 
46 
47 class TGedPopup : public TGCompositeFrame {
48 
49 protected:
51 
52 public:
53  TGedPopup(const TGWindow* p, const TGWindow *m, UInt_t w, UInt_t h,
54  UInt_t options = 0, Pixel_t back = GetDefaultFrameBackground());
55  virtual ~TGedPopup() { }
56 
57  virtual Bool_t HandleButton(Event_t *event);
58  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
59  void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h);
60  void EndPopup();
61 
62  ClassDef(TGedPopup,0) //popup window
63 };
64 
65 class TGedPatternFrame : public TGFrame {
66 
67 protected:
71  static TGGC *fgGC;
72  TGToolTip *fTip; // tool tip associated with a button
73  char fTipText[7];
74 
75  virtual void DoRedraw();
76 
77 public:
78  TGedPatternFrame(const TGWindow *p, Style_t pattern, Int_t width = 40,
79  Int_t height = 20);
80  virtual ~TGedPatternFrame() { delete fTip; }
81 
82  virtual Bool_t HandleButton(Event_t *event);
83  virtual Bool_t HandleCrossing(Event_t *event);
84  virtual void DrawBorder();
85 
86  void SetActive(Bool_t in) { fActive = in; gClient->NeedRedraw(this); }
87  Style_t GetPattern() const { return fPattern; }
88  static void SetFillStyle(TGGC* gc, Style_t fstyle); //set fill style for given GC
89 
90  ClassDef(TGedPatternFrame,0) //pattern frame
91 };
92 
94 
95 protected:
98  TGedPatternFrame *fCe[27];
99 
100 public:
101  TGedPatternSelector(const TGWindow *p);
102  virtual ~TGedPatternSelector();
103 
104  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
105  void SetActive(Int_t newat);
106  Int_t GetActive() const { return fActive; }
107 
108  ClassDef(TGedPatternSelector,0) //select pattern frame
109 };
110 
111 class TGedPatternPopup : public TGedPopup {
112 
113 protected:
115 
116 public:
117  TGedPatternPopup(const TGWindow *p, const TGWindow *m, Style_t pattern);
118  virtual ~TGedPatternPopup();
119 
120  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
121 
122  ClassDef(TGedPatternPopup,0) // Color selector popup
123 };
124 
125 class TGedSelect : public TGCheckButton {
126 
127 protected:
130 
131  virtual void DoRedraw();
132  void DrawTriangle(GContext_t gc, Int_t x, Int_t y);
133 
134 public:
135  TGedSelect(const TGWindow *p, Int_t id);
136  virtual ~TGedSelect();
137 
138  virtual Bool_t HandleButton(Event_t *event);
139 
140  virtual void Enable();
141  virtual void Disable();
142  virtual void SetPopup(TGedPopup* p) { fPopup = p; } // popup will be deleted in destructor.
143 
144  ClassDef(TGedSelect,0) //selection check-button
145 };
146 
148 
149 protected:
151 
152  virtual void DoRedraw();
153 
154 public:
155  TGedPatternSelect(const TGWindow *p, Style_t pattern, Int_t id);
156  virtual ~TGedPatternSelect() {}
157 
158  void SetPattern(Style_t pattern, Bool_t emit=kTRUE);
159  Style_t GetPattern() const { return fPattern; }
160  virtual TGDimension GetDefaultSize() const { return TGDimension(55, 21); }
161  virtual void PatternSelected(Style_t pattern = 0)
162  { Emit("PatternSelected(Style_t)", pattern ? pattern : GetPattern()); } // *SIGNAL*
163  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
164  virtual void SavePrimitive(std::ostream &out, Option_t * = "");
165 
166  ClassDef(TGedPatternSelect,0) //pattern selection check-button
167 };
168 
169 #endif
auto * m
Definition: textangle.C:8
short Style_t
Definition: RtypesCore.h:76
virtual ~TGedPopup()
const char Option_t
Definition: RtypesCore.h:62
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
Definition: TGaxis.cxx:2551
Style_t GetPattern() const
Handle_t GContext_t
Definition: GuiTypes.h:37
virtual void DrawBorder()
Draw frame border.
Definition: TGFrame.cxx:403
#define gClient
Definition: TGClient.h:166
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:320
ULong_t Pixel_t
Definition: GuiTypes.h:39
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
virtual void SetPopup(TGedPopup *p)
Style_t GetPattern() const
const TGWindow * fMsgWindow
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages generated by popup window.
void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h)
Place popup window at the specified place.
TGedPopup * fPopup
a SetFillStyle(0)
const TGWindow * fMsgWindow
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual ~TGedPatternSelect()
#define h(i)
Definition: RSha256.hxx:106
void EndPopup()
Ungrab pointer and unmap popup window.
long Long_t
Definition: RtypesCore.h:50
virtual TGDimension GetDefaultSize() const
default size
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.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:165
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.
const Bool_t kTRUE
Definition: RtypesCore.h:87
Definition: TGGC.h:31
virtual Bool_t HandleCrossing(Event_t *)
Definition: TGFrame.h:385
const TGWindow * fMsgWindow