Logo ROOT  
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:
50  const TGWindow *fMsgWindow;
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:
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:
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:
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
TGedPatternFrame::TGedPatternFrame
TGedPatternFrame(const TGWindow *p, Style_t pattern, Int_t width=40, Int_t height=20)
Pattern select ctor.
Definition: TGedPatternSelect.cxx:65
m
auto * m
Definition: textangle.C:8
TGedSelect::fDrawGC
TGGC * fDrawGC
Definition: TGedPatternSelect.h:128
TGWindow
Definition: TGWindow.h:31
TGedPatternSelect::~TGedPatternSelect
virtual ~TGedPatternSelect()
Definition: TGedPatternSelect.h:156
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGedPopup::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in popup window.
Definition: TGedPatternSelect.cxx:333
Style_t
short Style_t
Definition: RtypesCore.h:80
TGedPatternSelector::fCe
TGedPatternFrame * fCe[27]
Definition: TGedPatternSelect.h:98
TGedPopup::PlacePopup
void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h)
Place popup window at the specified place.
Definition: TGedPatternSelect.cxx:298
TGDimension
Definition: TGDimension.h:27
TGedPatternSelect::SetPattern
void SetPattern(Style_t pattern, Bool_t emit=kTRUE)
Set pattern.
Definition: TGedPatternSelect.cxx:675
TGedSelect::Enable
virtual void Enable()
Set widget state flag (kTRUE=enabled, kFALSE=disabled).
Definition: TGedPatternSelect.cxx:492
TGedPatternSelect::GetPattern
Style_t GetPattern() const
Definition: TGedPatternSelect.h:159
Pixel_t
ULong_t Pixel_t
Definition: GuiTypes.h:39
TGedPatternSelector::fMsgWindow
const TGWindow * fMsgWindow
Definition: TGedPatternSelect.h:97
TGedPatternFrame::DrawBorder
virtual void DrawBorder()
Draw border.
Definition: TGedPatternSelect.cxx:138
TGedPatternPopup::TGedPatternPopup
TGedPatternPopup(const TGWindow *p, const TGWindow *m, Style_t pattern)
Pattern popup constructor.
Definition: TGedPatternSelect.cxx:374
TGedPopup::fMsgWindow
const TGWindow * fMsgWindow
Definition: TGedPatternSelect.h:56
TGedSelect::DrawTriangle
void DrawTriangle(GContext_t gc, Int_t x, Int_t y)
Draw small triangle.
Definition: TGedPatternSelect.cxx:563
TGedSelect::DoRedraw
virtual void DoRedraw()
Draw separator and arrow.
Definition: TGedPatternSelect.cxx:510
TGedPatternSelect::TGedPatternSelect
TGedPatternSelect(const TGWindow *p, Style_t pattern, Int_t id)
Create and pop up pattern select window.
Definition: TGedPatternSelect.cxx:590
width
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
TGedPatternFrame::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
Definition: TGedPatternSelect.cxx:124
TGedPopup::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages generated by popup window.
Definition: TGedPatternSelect.cxx:353
TGedSelect::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button events in pattern select button.
Definition: TGedPatternSelect.cxx:455
TGedPatternSelector::SetActive
void SetActive(Int_t newat)
Set selected the current style.
Definition: TGedPatternSelect.cxx:226
TGedPatternFrame::fPattern
Style_t fPattern
Definition: TGedPatternSelect.h:70
TGedPopup::EndPopup
void EndPopup()
Ungrab pointer and unmap popup window.
Definition: TGedPatternSelect.cxx:289
x
Double_t x[n]
Definition: legend1.C:17
TGToolTip
Definition: TGToolTip.h:35
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:668
TGedPatternSelector::TGedPatternSelector
TGedPatternSelector(const TGWindow *p)
Create pattern popup window.
Definition: TGedPatternSelect.cxx:196
TGedPatternFrame::GetPattern
Style_t GetPattern() const
Definition: TGedPatternSelect.h:87
TGFrame
Definition: TGFrame.h:105
TGedPopup
Definition: TGedPatternSelect.h:47
TGedPatternSelect::fPattern
Style_t fPattern
Definition: TGedPatternSelect.h:150
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGedPatternFrame::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TGedPatternSelect.cxx:110
bool
TGedPatternFrame::SetFillStyle
static void SetFillStyle(TGGC *gc, Style_t fstyle)
Set fill area style.
Definition: TGedPatternSelect.cxx:164
GContext_t
Handle_t GContext_t
Definition: GuiTypes.h:37
gClient
#define gClient
Definition: TGClient.h:166
TGCheckButton
Definition: TGButton.h:264
TGedSelect::~TGedSelect
virtual ~TGedSelect()
Destructor of pattern select button.
Definition: TGedPatternSelect.cxx:445
TGedPatternFrame::fActive
Bool_t fActive
Definition: TGedPatternSelect.h:69
TGedPatternSelect
Definition: TGedPatternSelect.h:147
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGedPatternFrame::fMsgWindow
const TGWindow * fMsgWindow
Definition: TGedPatternSelect.h:68
h
#define h(i)
Definition: RSha256.hxx:124
TGedPatternSelect::DoRedraw
virtual void DoRedraw()
Draw selected pattern as current one.
Definition: TGedPatternSelect.cxx:616
TGedPatternSelector::~TGedPatternSelector
virtual ~TGedPatternSelector()
Delete pattern popup window.
Definition: TGedPatternSelect.cxx:218
TGedPatternFrame::fTipText
char fTipText[7]
Definition: TGedPatternSelect.h:73
TGGC
Definition: TGGC.h:31
Long_t
long Long_t
Definition: RtypesCore.h:54
TGedPopup::TGedPopup
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: TGedPatternSelect.cxx:271
TGedPatternFrame::SetActive
void SetActive(Bool_t in)
Definition: TGedPatternSelect.h:86
TGedPatternSelect::GetDefaultSize
virtual TGDimension GetDefaultSize() const
default size
Definition: TGedPatternSelect.h:160
TGedPatternPopup::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages generated by pattern popup window.
Definition: TGedPatternSelect.cxx:398
y
Double_t y[n]
Definition: legend1.C:17
TGedPatternSelector::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process message generated by pattern popup window.
Definition: TGedPatternSelect.cxx:242
TGedPatternSelector::fActive
Int_t fActive
Definition: TGedPatternSelect.h:96
TGedPatternPopup::fCurrentPattern
Style_t fCurrentPattern
Definition: TGedPatternSelect.h:114
unsigned int
TGedPatternSelect::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process message according to the user input.
Definition: TGedPatternSelect.cxx:601
TGedPatternSelect::PatternSelected
virtual void PatternSelected(Style_t pattern=0)
Definition: TGedPatternSelect.h:161
TGedPopup::~TGedPopup
virtual ~TGedPopup()
Definition: TGedPatternSelect.h:61
TGedPatternFrame::fTip
TGToolTip * fTip
Definition: TGedPatternSelect.h:72
TGedPatternSelector
Definition: TGedPatternSelect.h:93
TGToolTip.h
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGButton.h
Event_t
Definition: GuiTypes.h:173
TGedSelect::SetPopup
virtual void SetPopup(TGedPopup *p)
Definition: TGedPatternSelect.h:142
TGedPatternFrame::DoRedraw
virtual void DoRedraw()
Redraw selected pattern.
Definition: TGedPatternSelect.cxx:147
TGedPatternPopup::~TGedPatternPopup
virtual ~TGedPatternPopup()
Destructor of pattern popup window.
Definition: TGedPatternSelect.cxx:390
TGedPatternSelector::GetActive
Int_t GetActive() const
Definition: TGedPatternSelect.h:106
TGedSelect
Definition: TGedPatternSelect.h:125
TGCompositeFrame
Definition: TGFrame.h:324
TGedPatternFrame::fgGC
static TGGC * fgGC
Definition: TGedPatternSelect.h:71
TGedSelect::Disable
virtual void Disable()
Clear widget state flag.
Definition: TGedPatternSelect.cxx:501
TGedSelect::TGedSelect
TGedSelect(const TGWindow *p, Int_t id)
Create pattern select button.
Definition: TGedPatternSelect.cxx:420
TGedPatternFrame
Definition: TGedPatternSelect.h:65
TGedSelect::fPopup
TGedPopup * fPopup
Definition: TGedPatternSelect.h:129
TGedPatternPopup
Definition: TGedPatternSelect.h:111
TGedPatternFrame::~TGedPatternFrame
virtual ~TGedPatternFrame()
Definition: TGedPatternSelect.h:80
TQObject::Emit
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
TGedPatternSelect::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save the pattern select widget as a C++ statement(s) on output stream out.
Definition: TGedPatternSelect.cxx:686
ROOT::TMetaUtils::propNames::pattern
static const std::string pattern("pattern")
int