Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGuiBldHintsButton.cxx
Go to the documentation of this file.
1// @(#)root/guibuilder:$Id$
2// Author: Valeriy Onuchin 12/09/04
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, 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#include "TGuiBldHintsButton.h"
13#include "TGResourcePool.h"
14#include "TVirtualX.h"
15
16
17
18/** \class TGuiBldHintsButton
19 \ingroup guibuilder
20
21Special button class used for editing layout hints in the ROOT GUI Builder.
22
23*/
24
25
27
28
29////////////////////////////////////////////////////////////////////////////////
30////////////////////////////////////////////////////////////////////////////////
31/// Constructor.
32
34 TGButton(p, id)
35{
37
38 switch ((ELayoutHints)fWidgetId) {
39 case kLHintsCenterX:
40 case kLHintsExpandX:
41 Resize(40, 15);
42 break;
43 case kLHintsCenterY:
44 case kLHintsExpandY:
45 Resize(15, 40);
46 break;
47 default:
48 Resize(15, 15);
49 break;
50 }
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Redraw button.
55
57{
59
60 switch (fWidgetId) {
61 case kLHintsCenterX:
63 break;
64 case kLHintsCenterY:
66 break;
67 case kLHintsExpandX:
69 break;
70 case kLHintsExpandY:
72 break;
73 case (kLHintsTop | kLHintsLeft):
75 break;
76 case (kLHintsTop | kLHintsRight):
78 break;
81 break;
84 break;
85 default:
87 break;
88 }
89}
90
91////////////////////////////////////////////////////////////////////////////////
92/// Draw expand X button.
93
95{
96 const int dist = 3;
97 const int amplitude = TMath::Min(3, (int)fHeight/3);
98 int base = fHeight/2;
99 int i = 0;
100 const TGResourcePool *pool = fClient->GetResourcePool();
101 const TGGC* gc = pool->GetWhiteGC();
102
103 if ((fState == kButtonDown) || (fState == kButtonEngaged)) {
104 base++;
105 }
106
107 for ( i = 1; i < (int)fWidth/3 - 2; ++i ) {
108 gVirtualX->DrawLine(fId, gc->GetGC(), i * dist, base - amplitude,
109 i * dist + dist/2, base + amplitude);
110 }
111 gc = IsEnabled() ? pool->GetSelectedBckgndGC() : pool->GetFrameShadowGC();
112
113 for ( i = 1; i < (int)fWidth/3 - 2; ++i ) {
114 gVirtualX->DrawLine(fId, gc->GetGC(), i * dist + dist/2, base + amplitude,
115 i * dist + dist, base - amplitude);
116 }
117 gVirtualX->DrawLine(fId, gc->GetGC(), 3, 6, 3, fHeight - 6);
118 gVirtualX->DrawLine(fId, gc->GetGC(), fWidth - 6, 6, fWidth - 6, fHeight - 6);
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Draw expand Y button.
123
125{
126 const int dist = 3;
127 const int amplitude = TMath::Min(3, (int)fWidth/3);
128 int base = fWidth/2;
129 int i = 0;
130
131 if ((fState == kButtonDown) || (fState == kButtonEngaged)) {
132 base++;
133 }
134 const TGResourcePool *pool = fClient->GetResourcePool();
135 const TGGC* gc = pool->GetWhiteGC();
136
137 for ( i = 1; i < (int)fHeight/3 - 2; ++i ) {
138 gVirtualX->DrawLine(fId, gc->GetGC(), base - amplitude, i * dist,
139 base + amplitude,i * dist + dist/2);
140 }
141
142 gc = IsEnabled() ? pool->GetSelectedBckgndGC() : pool->GetFrameShadowGC();
143
144 for ( i = 1; i < (int)fHeight/3 - 2; ++i ) {
145 gVirtualX->DrawLine(fId, gc->GetGC(), base + amplitude, i * dist + dist/2,
146 base - amplitude, i * dist + dist );
147 }
148 gVirtualX->DrawLine(fId, gc->GetGC(), 6, 3, fWidth - 6, 3);
149 gVirtualX->DrawLine(fId, gc->GetGC(), 6, fHeight - 6, fWidth - 6, fHeight - 6);
150}
151
152////////////////////////////////////////////////////////////////////////////////
153/// Draw center X buton.
154
156{
157 int base = fHeight/2;
158 int x = 6;
159 int y = 6;
160
161 const TGResourcePool *pool = fClient->GetResourcePool();
162 const TGGC* gc = pool->GetWhiteGC();
163
164 if ((fState == kButtonDown) || (fState == kButtonEngaged)) {
165 base++;
166 x++;
167 y++;
168 }
169
170 gVirtualX->DrawLine(fId, gc->GetGC(), x, base, x + fWidth - 12, base);
171
172 gc = IsEnabled() ? pool->GetSelectedBckgndGC() : pool->GetFrameShadowGC();
173
174 gVirtualX->DrawLine(fId, gc->GetGC(), x, base - 1, x + fWidth/2 - 12, base - 1);
175 gVirtualX->DrawLine(fId, gc->GetGC(), x + fWidth/2, base - 1, x + fWidth - 12, base - 1);
176 gVirtualX->DrawLine(fId, gc->GetGC(), x, base + 1, x + fWidth/2 - 12, base + 1);
177 gVirtualX->DrawLine(fId, gc->GetGC(), x + fWidth/2, base + 1, x + fWidth - 12, base + 1);
178
179 Point_t arrow[3];
180 arrow[0].fX = arrow[01].fX = x + fWidth/2 - 12;
181 arrow[2].fX = x + fWidth/2 - 6;
182 arrow[2].fY = y + fHeight/2 - 6;
183 arrow[0].fY = arrow[2].fY - 4;
184 arrow[1].fY = arrow[2].fY + 4;
185 gVirtualX->FillPolygon(fId, gc->GetGC(), (Point_t*)&arrow, 3);
186
187 arrow[0].fX = arrow[01].fX = x + fWidth/2;
188 gVirtualX->FillPolygon(fId, gc->GetGC(), (Point_t*)&arrow, 3);
189
190 gVirtualX->DrawLine(fId, gc->GetGC(), x, y, x, y + fHeight - 12);
191 gVirtualX->DrawLine(fId, gc->GetGC(), x + fWidth - 12, y, x + fWidth - 12, y + fHeight - 12);
192}
193
194////////////////////////////////////////////////////////////////////////////////
195/// Draw center Y button.
196
198{
199 int base = fWidth/2;
200 int x = 6;
201 int y = 6;
202
203 const TGResourcePool *pool = fClient->GetResourcePool();
204 const TGGC* gc = pool->GetWhiteGC();
205
206 if ((fState == kButtonDown) || (fState == kButtonEngaged)) {
207 base++;
208 x++;
209 y++;
210 }
211
212 gVirtualX->DrawLine(fId, gc->GetGC(), base, y, base, y + fHeight - 12);
213
214 gc = IsEnabled() ? pool->GetSelectedBckgndGC() : pool->GetFrameShadowGC();
215
216 gVirtualX->DrawLine(fId, gc->GetGC(), base - 1, y, base - 1, y + fHeight/2 - 12);
217 gVirtualX->DrawLine(fId, gc->GetGC(), base - 1, y + fHeight/2, base - 1, y + fHeight - 12);
218 gVirtualX->DrawLine(fId, gc->GetGC(), base + 1, y, base + 1, y + fHeight/2 - 12);
219 gVirtualX->DrawLine(fId, gc->GetGC(), base + 1, y + fHeight/2, base + 1, y + fHeight - 12);
220
221 Point_t arrow[3];
222 arrow[0].fY = arrow[01].fY = y + fHeight/2 - 12;
223 arrow[2].fY = y + fHeight/2 - 6;
224 arrow[2].fX = x + fWidth/2 - 6;
225 arrow[0].fX = arrow[2].fX - 4;
226 arrow[1].fX = arrow[2].fX + 4;
227 gVirtualX->FillPolygon(fId, gc->GetGC(), (Point_t*)&arrow, 3);
228
229 arrow[0].fY = arrow[01].fY = y + fHeight/2;
230 gVirtualX->FillPolygon(fId, gc->GetGC(), (Point_t*)&arrow, 3);
231 gVirtualX->DrawLine(fId, gc->GetGC(), x, y, x + fWidth - 12, y);
232 gVirtualX->DrawLine(fId, gc->GetGC(), x, y + fHeight - 12, x + fWidth - 12, y + fHeight - 12);
233}
234
235////////////////////////////////////////////////////////////////////////////////
236/// DrawTopLeft.
237
239{
240}
241
242////////////////////////////////////////////////////////////////////////////////
243/// DrawTopRight.
244
246{
247}
248
249////////////////////////////////////////////////////////////////////////////////
250/// DrawBottomLeft.
251
253{
254}
255
256////////////////////////////////////////////////////////////////////////////////
257/// DrawBottomRight.
258
260{
261}
262
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
@ kButtonDown
Definition TGButton.h:54
@ kButtonEngaged
Definition TGButton.h:55
ELayoutHints
Definition TGLayout.h:22
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsCenterX
Definition TGLayout.h:25
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
#define gVirtualX
Definition TVirtualX.h:338
A button abstract base class.
Definition TGButton.h:68
EButtonState fState
button state
Definition TGButton.h:75
Bool_t fStayDown
true if button has to stay down
Definition TGButton.h:76
const TGResourcePool * GetResourcePool() const
Definition TGClient.h:124
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
UInt_t fHeight
frame height
Definition TGFrame.h:88
void DoRedraw() override
Redraw the frame.
Definition TGFrame.cxx:430
UInt_t fWidth
frame width
Definition TGFrame.h:87
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
This class implements a pool for the default GUI resource set, like GC's, colors, fonts,...
const TGGC * GetFrameShadowGC() const
const TGGC * GetSelectedBckgndGC() const
const TGGC * GetWhiteGC() const
Int_t fWidgetId
the widget id (used for event processing)
Definition TGWidget.h:46
Bool_t IsEnabled() const
Definition TGWidget.h:69
ROOT GUI Window base class.
Definition TGWindow.h:23
Special button class used for editing layout hints in the ROOT GUI Builder.
virtual void DrawBottomLeft()
DrawBottomLeft.
virtual void DrawExpandX()
Draw expand X button.
virtual void DrawTopRight()
DrawTopRight.
virtual void DrawCenterX()
Draw center X buton.
virtual void DrawCenterY()
Draw center Y button.
virtual void DrawBottomRight()
DrawBottomRight.
virtual void DrawTopLeft()
DrawTopLeft.
virtual void DoRedraw()
Redraw button.
TGuiBldHintsButton(const TGWindow *p, Int_t id)
Constructor.
virtual void DrawExpandY()
Draw expand Y button.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:198
Point structure (maps to the X11 XPoint structure)
Definition GuiTypes.h:356