Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGColorSelect.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Bertrand Bellenot + Fons Rademakers 22/08/02
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
13 This source is based on Xclass95, a Win95-looking GUI toolkit.
14 Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.
15
16 Xclass95 is free software; you can redistribute it and/or
17 modify it under the terms of the GNU Library General Public
18 License as published by the Free Software Foundation; either
19 version 2 of the License, or (at your option) any later version.
20
21**************************************************************************/
22
23
24/** \class TGColorFrame
25 \ingroup guiwidgets
26
27A small frame with border showing a specific color.
28
29*/
30
31
32/** \class TG16ColorSelector
33 \ingroup guiwidgets
34
35A composite frame with 16 TGColorFrames.
36
37*/
38
39
40/** \class TGColorPopup
41 \ingroup guiwidgets
42
43A popup containing a TG16ColorSelector and a "More..." button which popups up a
44TGColorDialog allowing custom color selection.
45
46*/
47
48
49/** \class TGColorSelect
50\ingroup guiwidgets
51
52Like a checkbutton but instead of the check mark there is color area with a little down
53arrow. When clicked on the arrow the TGColorPopup pops up.
54
55Selecting a color in this widget will generate the event:
56 - kC_COLORSEL, kCOL_SELCHANGED, widget id, pixel.
57
58and the signal:
59
60 - ColorSelected(Pixel_t color)
61
62*/
63
64
65#include "TGClient.h"
66#include "TGMsgBox.h" // for kMBOk
67#include "TGGC.h"
68#include "TGColorSelect.h"
69#include "TGColorDialog.h"
70#include "TGResourcePool.h"
71#include "RConfigure.h"
72#include "TG3DLine.h"
73#include "TColor.h"
74#include "TVirtualX.h"
75
76#include <iostream>
77
82
83
84////////////////////////////////////////////////////////////////////////////////
85/// TGColorFrame constructor.
86/// The TGColorFrame is a small frame with border showing a specific color.
87
89 TGFrame(p, 20, 20, kOwnBackground, color)
90{
91 SetBackgroundColor(color);
92
93 fPixel = fColor = color;
94
96 fMsgWindow = p;
98
99 fGrayGC = GetShadowGC()();
101}
102
103////////////////////////////////////////////////////////////////////////////////
104/// Handle button events in TGColorFrame.
105
107{
108 if (event->fType == kButtonPress) {
110 } else { // kButtonRelease
112 }
113
114 return kTRUE;
115}
116
117////////////////////////////////////////////////////////////////////////////////
118/// Draw TGColorFrame border.
119
121{
122 gVirtualX->DrawRectangle(fId, GetBckgndGC()(), 0, 0, fWidth - 1, fHeight - 1);
124}
125
126////////////////////////////////////////////////////////////////////////////////
127/// TG16ColorSelector constructor.
128/// The TG16ColorSelector is a composite frame with 16 TGColorFrames.
129
131 TGCompositeFrame(p, 10, 10)
132{
133 SetLayoutManager(new TGMatrixLayout(this, 4, 4, 1, 1));
134
135 fCe[0] = new TGColorFrame(this, TColor::Number2Pixel(0), 0);
136 fCe[1] = new TGColorFrame(this, TColor::Number2Pixel(1), 1);
137 fCe[2] = new TGColorFrame(this, TColor::Number2Pixel(2), 2);
138 fCe[3] = new TGColorFrame(this, TColor::Number2Pixel(3), 3);
139 fCe[4] = new TGColorFrame(this, TColor::Number2Pixel(4), 4);
140 fCe[5] = new TGColorFrame(this, TColor::Number2Pixel(5), 5);
141 fCe[6] = new TGColorFrame(this, TColor::Number2Pixel(6), 6);
142 fCe[7] = new TGColorFrame(this, TColor::Number2Pixel(7), 7);
143 fCe[8] = new TGColorFrame(this, TColor::Number2Pixel(8), 8);
144 fCe[9] = new TGColorFrame(this, TColor::Number2Pixel(9), 9);
145 fCe[10] = new TGColorFrame(this, TColor::Number2Pixel(30), 10);
146 fCe[11] = new TGColorFrame(this, TColor::Number2Pixel(38), 11);
147 fCe[12] = new TGColorFrame(this, TColor::Number2Pixel(41), 12);
148 fCe[13] = new TGColorFrame(this, TColor::Number2Pixel(42), 13);
149 fCe[14] = new TGColorFrame(this, TColor::Number2Pixel(50), 14);
150 fCe[15] = new TGColorFrame(this, TColor::Number2Pixel(51), 15);
151
152 for (Int_t i = 0; i < 16; i++)
154
155 fMsgWindow = p;
156 fActive = -1;
157
159}
160
161////////////////////////////////////////////////////////////////////////////////
162/// TG16ColorSelector destructor.
163
165{
166 Cleanup();
167}
168
169////////////////////////////////////////////////////////////////////////////////
170/// Set active color frame.
171
173{
174 if (fActive != newat) {
175 if ((fActive >= 0) && (fActive < 16)) {
177 }
178 fActive = newat;
179 if ((fActive >= 0) && (fActive < 16)) {
181 }
182 }
183}
184
185////////////////////////////////////////////////////////////////////////////////
186/// Process messages for TG16ColorSelector.
187
189{
190 switch (GET_MSG(msg)) {
191 case kC_COLORSEL:
192 switch (GET_SUBMSG(msg)) {
193 case kCOL_SELCHANGED:
194 switch (parm1) {
195 case kButton1:
198 parm1, parm2);
199 break;
200 }
201 break;
202
203 case kCOL_CLICK:
204 switch (parm1) {
205 case kButton1:
206 SetActive(parm2);
207 break;
208 }
209 break;
210 }
211 }
212
213 return kTRUE;
214}
215
216////////////////////////////////////////////////////////////////////////////////
217/// TGColorPopup constructor.
218/// The TGColorPopup is a popup containing a TG16ColorSelector and a "More..."
219/// button which popups up a TGColorDialog allowing custom color selection.
220
223 GetDefaultFrameBackground())
224{
225 fMsgWindow = m;
226 fCurrentColor = color;
227
229
230 wattr.fMask = kWAOverrideRedirect; // | kWASaveUnder ;
231 wattr.fOverrideRedirect = kTRUE;
232 //wattr.fSaveUnder = kTRUE;
233 gVirtualX->ChangeWindowAttributes(fId, &wattr);
234
236
237 fActive = -1;
239
240 TG16ColorSelector *cs = new TG16ColorSelector(this);
241 AddFrame(cs, new TGLayoutHints(kLHintsCenterX, 1, 1, 1, 1));
243 new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 2, 2, 2, 2));
244 TGTextButton *other = new TGTextButton(this, "Other...", 102);
245 other->SetToolTipText("Popups up Color Selector");
246 other->Associate(this);
247 AddFrame(other, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX, 2, 2, 2, 2));
248
250
251 Resize(cs->GetDefaultWidth() + 6, cs->GetDefaultHeight() +
252 other->GetDefaultHeight());
254}
255
256////////////////////////////////////////////////////////////////////////////////
257/// TGColorPopup destructor.
258
260{
261 Cleanup();
262}
263
264////////////////////////////////////////////////////////////////////////////////
265/// Ungrab pointer and unmap window.
266
268{
269 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
270 UnmapWindow();
271}
272
273////////////////////////////////////////////////////////////////////////////////
274/// Popup TGColorPopup at x,y position
275
277{
278 Int_t rx, ry;
279 UInt_t rw, rh;
280
281 // Parent is root window for the popup:
282 gVirtualX->GetWindowSize(fParent->GetId(), rx, ry, rw, rh);
283
284 if (gVirtualX->InheritsFrom("TGWin32")) {
285 if ((x > 0) && ((x + abs(rx) + (Int_t)fWidth) > (Int_t)rw))
286 x = rw - abs(rx) - fWidth;
287 if ((y > 0) && (y + abs(ry) + (Int_t)fHeight > (Int_t)rh))
288 y = rh - fHeight;
289 } else {
290 if (x < 0) x = 0;
291 if (x + fWidth > rw) x = rw - fWidth;
292 if (y < 0) y = 0;
293 if (y + fHeight > rh) y = rh - fHeight;
294 }
295
296 MoveResize(x, y, w, h);
298 Layout();
299 MapRaised();
300
304
306
307 gClient->WaitForUnmap(this);
308 EndPopup();
309
310 if (fLaunchDialog) {
311 Int_t retc;
312 ULong_t color = fCurrentColor;
313
314 new TGColorDialog(gClient->GetDefaultRoot(), this, &retc, &color);
315
316 if (retc == kMBOk) {
317 fCurrentColor = color;
319 -1, color);
320 }
321 }
322 DeleteWindow();
323}
324
325////////////////////////////////////////////////////////////////////////////////
326/// Handle mouse button events for TGColorPopup.
327
329{
330 if (event->fX < 0 || event->fX >= (Int_t) fWidth ||
331 event->fY < 0 || event->fY >= (Int_t) fHeight) {
332 if (event->fType == kButtonRelease)
333 UnmapWindow();
334 } else {
336 if (f && f != this) {
337 TranslateCoordinates(f, event->fX, event->fY, event->fX, event->fY);
338 f->HandleButton(event);
339 }
340 }
341 return kTRUE;
342}
343
344////////////////////////////////////////////////////////////////////////////////
345/// Process messages for TGColorPopup.
346
348{
349 switch (GET_MSG(msg)) {
350 case kC_COLORSEL:
351 switch (GET_SUBMSG(msg)) {
352 case kCOL_SELCHANGED:
354 parm1, parm2);
355 UnmapWindow();
356 break;
357
358 default:
359 break;
360 }
361 break;
362
363 case kC_COMMAND:
364 switch (GET_SUBMSG(msg)) {
365 case kCM_BUTTON:
366 if (parm1 == 102) {
368 UnmapWindow();
369 }
370 break;
371 }
372 break;
373 }
374 return kTRUE;
375}
376
377////////////////////////////////////////////////////////////////////////////////
378/// Emit a signal to see preview.
379
381{
382 if (fClient->IsEditable()) return;
383
384 fCurrentColor = color;
386}
387
388////////////////////////////////////////////////////////////////////////////////
389/// Emit a signal to see preview.
390
392{
393 if (fClient->IsEditable()) return;
394
395 TColor *tcolor = (TColor *)color;
396 fCurrentColor = tcolor->GetPixel();
398}
399
400////////////////////////////////////////////////////////////////////////////////
401/// TGColorSelect constructor.
402/// The TGColorSelect widget is like a checkbutton but instead of the check
403/// mark there is color area with a little down arrow.
404/// When clicked on the arrow the TGColorPopup pops up.
405
407 TGCheckButton(p, "", id)
408{
409 if (!p && fClient->IsEditable() && !color) {
410 color = TColor::Number2Pixel(6); // magenta
411 }
412
413 fColor = color;
414 fColorPopup = 0;
416
417 Enable();
421
423}
424
425////////////////////////////////////////////////////////////////////////////////
426/// TGColorSelect destructor.
427
429{
430 delete fColorPopup;
431}
432
433////////////////////////////////////////////////////////////////////////////////
434/// Process messages for TGColorSelect.
435
437{
438 switch (GET_MSG(msg)) {
439 case kC_COLORSEL:
440 switch (GET_SUBMSG(msg)) {
441 case kCOL_SELCHANGED:
442 {
443 if (parm1 == 0) {
444 SetAlphaColor((ULong_t)parm2);
445 parm1 = (Longptr_t)fWidgetId; // parm1 needs to pass the widget Id
447 parm1, parm2);
448 }
449 else {
450 SetColor(parm2);
451 parm1 = (Longptr_t)fWidgetId; // parm1 needs to pass the widget Id
453 parm1, parm2);
454 }
455 }
456 break;
457
458 default:
459 break;
460 }
461 break;
462 }
463 return kTRUE;
464}
465
466////////////////////////////////////////////////////////////////////////////////
467/// Handle button events for TGColorSelect.
468
470{
472 if (!IsEnabled()) return kTRUE;
473
474 if (event->fCode != kButton1) return kFALSE;
475
476 if ((event->fType == kButtonPress) && HasFocus())
477 WantFocus();
478
479 if (event->fType == kButtonPress) {
480 fPressPos.fX = fX;
481 fPressPos.fY = fY;
482
483 if (fState != kButtonDown) {
486 }
487 } else {
488 if (fState != kButtonUp) {
490
491 // case when it was dragged during guibuilding
492 if ((fPressPos.fX != fX) || (fPressPos.fY != fY)) {
493 return kFALSE;
494 }
495 Window_t wdummy;
496 Int_t ax, ay;
497
498 if (!fColorPopup)
499 fColorPopup = new TGColorPopup(gClient->GetDefaultRoot(), this, fColor);
500
501 gVirtualX->TranslateCoordinates(fId, gClient->GetDefaultRoot()->GetId(),
502 0, fHeight, ax, ay, wdummy);
503
504#ifdef R__HAS_COCOA
505 gVirtualX->SetWMTransientHint(fColorPopup->GetId(), GetId());
506#endif
509 fColorPopup = 0;
510 }
511 }
512 return kTRUE;
513}
514
515////////////////////////////////////////////////////////////////////////////////
516/// Set state of widget as enabled.
517
519{
520 if (on) {
522 } else {
524 }
525 fClient->NeedRedraw(this);
526}
527
528////////////////////////////////////////////////////////////////////////////////
529/// Set state of widget as disabled.
530
532{
534 fClient->NeedRedraw(this);
535}
536
537////////////////////////////////////////////////////////////////////////////////
538/// Redraw TGColorSelect widget.
539
541{
542 Int_t x, y;
543 UInt_t w, h;
544
546
547 if (IsEnabled()) {
548
549 // color rectangle
550
551 x = fBorderWidth + 2;
552 y = fBorderWidth + 2; // 1;
553 w = 22;
554 h = fHeight - (fBorderWidth * 2) - 4; // -3; // 14
555
556 if (fState == kButtonDown) { ++x; ++y; }
557
558#ifdef R__HAS_COCOA
559 //Adjustment for Quartz 2D is required:
560 //first, I DO not try to fit filled rectangle into outline - this
561 //simply DOES NOT work (with retina/non-retina display, for example.
562 //First - fill rectangle, then draw outline.
563 gVirtualX->FillRectangle(fId, fDrawGC(), x + 1, y + 1, w - 1, h - 1);
564 gVirtualX->DrawRectangle(fId, GetShadowGC()(), x + 1, y + 1, w - 1, h - 1);
565#else
566 gVirtualX->DrawRectangle(fId, GetShadowGC()(), x, y, w - 1, h - 1);
567 gVirtualX->FillRectangle(fId, fDrawGC(), x + 1, y + 1, w - 2, h - 2);
568#endif
569
570 // separator
571
572 x = fWidth - 6 - fBorderWidth - 6;
573 y = fBorderWidth + 1;
574 h = fHeight - fBorderWidth - 1; // actually y1
575
576 if (fState == kButtonDown) { ++x; ++y; }
577
578 gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, h - 2);
579 gVirtualX->DrawLine(fId, GetHilightGC()(), x + 1, y, x + 1, h - 1);
580 gVirtualX->DrawLine(fId, GetHilightGC()(), x, h - 1, x + 1, h - 1);
581
582 // arrow
583
584 x = fWidth - 6 - fBorderWidth - 2;
585 y = (fHeight - 4) / 2 + 1;
586
587 if (fState == kButtonDown) { ++x; ++y; }
588
589 DrawTriangle(GetBlackGC()(), x, y);
590
591 } else {
592
593 // sunken rectangle
594
595 x = fBorderWidth + 2;
596 y = fBorderWidth + 2; // 1;
597 w = 22;
598 h = fHeight - (fBorderWidth * 2) - 4; // 3;
599
601
602 // separator
603
604 x = fWidth - 6 - fBorderWidth - 6;
605 y = fBorderWidth + 1;
606 h = fHeight - fBorderWidth - 1; // actually y1
607
608 gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, h - 2);
609 gVirtualX->DrawLine(fId, GetHilightGC()(), x + 1, y, x + 1, h - 1);
610 gVirtualX->DrawLine(fId, GetHilightGC()(), x, h - 1, x + 1, h - 1);
611
612 // sunken arrow
613
614 x = fWidth - 6 - fBorderWidth - 2;
615 y = (fHeight - 4) / 2 + 1;
616
617 DrawTriangle(GetHilightGC()(), x + 1, y + 1);
619 }
620}
621
622////////////////////////////////////////////////////////////////////////////////
623/// Draw triangle (arrow) on which user can click to open TGColorPopup.
624
626{
627 Point_t points[3];
628
629#ifdef R__HAS_COCOA
630 //When it comes to tiny pixel-precise objects like this,
631 //Quartz is not really good: triangle is ugly and wrong.
632 //I have to adjust pixels manually.
633 points[0].fX = x;
634 points[0].fY = y;
635 points[1].fX = x + 6;
636 points[1].fY = y;
637 points[2].fX = x + 3;
638 points[2].fY = y + 3;
639#else
640 points[0].fX = x;
641 points[0].fY = y;
642 points[1].fX = x + 5;
643 points[1].fY = y;
644 points[2].fX = x + 2;
645 points[2].fY = y + 3;
646#endif
647
648 gVirtualX->FillPolygon(fId, gc, points, 3);
649}
650
651////////////////////////////////////////////////////////////////////////////////
652/// Set color.
653
655{
656 fColor = color;
657 fDrawGC.SetForeground(color);
658 gClient->NeedRedraw(this);
659 if (emit)
660 ColorSelected(fColor); // emit a signal
661}
662
663////////////////////////////////////////////////////////////////////////////////
664/// Set color.
665
667{
668 if (emit) {
669 AlphaColorSelected(color); //emit opacity signal
670 }
671}
672
673
674////////////////////////////////////////////////////////////////////////////////
675/// Save a color select widget as a C++ statement(s) on output stream out
676
677void TGColorSelect::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
678{
679 char quote = '"';
680 static Int_t nn = 1;
681 TString cvar = TString::Format("ColPar%d",nn);
682
683 ULong_t color = GetColor();
684 const char *colorname = TColor::PixelAsHexString(color);
685 gClient->GetColorByName(colorname, color);
686
687 out << std::endl << " // color select widget" << std::endl;
688 out << " ULong_t " << cvar.Data() << ";" << std::endl;
689 out << " gClient->GetColorByName(" << quote << colorname << quote
690 << ", " << cvar.Data() << ");" << std::endl;
691
692 out <<" TGColorSelect *";
693 out << GetName() << " = new TGColorSelect(" << fParent->GetName()
694 << ", " << cvar.Data() << ", " << WidgetId() << ");" << std::endl;
695 nn++;
696
697 if (option && strstr(option, "keep_names"))
698 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
699
700 if (!IsEnabled()) {
701 out << " " << GetName() << "->Disable();" << std::endl;
702 }
703 out << std::endl;
704}
705
@ kButtonRelease
Definition GuiTypes.h:60
@ kButtonPress
Definition GuiTypes.h:60
const Mask_t kWAOverrideRedirect
Definition GuiTypes.h:149
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
@ kRaisedFrame
Definition GuiTypes.h:384
@ kSunkenFrame
Definition GuiTypes.h:383
@ kDoubleBorder
Definition GuiTypes.h:385
@ kOwnBackground
Definition GuiTypes.h:391
const Handle_t kNone
Definition GuiTypes.h:88
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:166
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
@ kButton1
Definition GuiTypes.h:214
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
long Longptr_t
Definition RtypesCore.h:82
unsigned long ULongptr_t
Definition RtypesCore.h:83
const Bool_t kFALSE
Definition RtypesCore.h:101
unsigned long ULong_t
Definition RtypesCore.h:55
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
#define gClient
Definition TGClient.h:157
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsCenterX
Definition TGLayout.h:25
@ kLHintsExpandX
Definition TGLayout.h:30
@ kMBOk
Definition TGMsgBox.h:33
@ kWidgetIsEnabled
Definition TGWidget.h:37
XFontStruct * id
Definition TGX11.cxx:109
#define gVirtualX
Definition TVirtualX.h:338
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Int_t GET_MSG(Long_t val)
@ kCOL_CLICK
@ kCOL_SELCHANGED
@ kC_COLORSEL
@ kC_COMMAND
@ kCM_BUTTON
Int_t GET_SUBMSG(Long_t val)
point * points
Definition X3DBuffer.c:22
The color creation and management class.
Definition TColor.h:19
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition TColor.cxx:2069
static const char * PixelAsHexString(ULong_t pixel)
Convert machine dependent pixel value (obtained via RGB2Pixel or via Number2Pixel() or via TColor::Ge...
Definition TColor.cxx:2162
ULong_t GetPixel() const
Return pixel value corresponding to this color.
Definition TColor.cxx:1493
A composite frame with 16 TGColorFrames.
void SetActive(Int_t newat)
Set active color frame.
virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Process messages for TG16ColorSelector.
TGColorFrame * fCe[16]
matrix of color cells
Int_t fActive
index of active color cell
virtual ~TG16ColorSelector()
TG16ColorSelector destructor.
const TGWindow * fMsgWindow
window handling container messages
TG16ColorSelector(const TG16ColorSelector &)=delete
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:445
EButtonState fState
button state
Definition TGButton.h:75
Selects different options.
Definition TGButton.h:264
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
EButtonState fPrevState
previous check button state
Definition TGButton.h:272
Bool_t IsEditable() const
Definition TGClient.h:89
const TGResourcePool * GetResourcePool() const
Definition TGClient.h:124
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:372
A full featured color selection dialog.
A small frame with border showing a specific color.
virtual Bool_t HandleButton(Event_t *event)
Handle button events in TGColorFrame.
TGColorFrame(const TGColorFrame &)=delete
GContext_t fGrayGC
Shadow GC.
const TGWindow * fMsgWindow
window handling container messages
virtual void DrawBorder()
Draw TGColorFrame border.
void SetActive(Bool_t in)
Bool_t fActive
kTRUE if this color cell is active
Pixel_t fPixel
color value of this cell
Pixel_t fColor
returned color value
A popup containing a TG16ColorSelector and a "More..." button which popups up a TGColorDialog allowin...
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button events for TGColorPopup.
const TGWindow * fMsgWindow
window handling container messages
virtual ~TGColorPopup()
TGColorPopup destructor.
void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h)
Popup TGColorPopup at x,y position.
void PreviewAlphaColor(ULongptr_t color)
Emit a signal to see preview.
void EndPopup()
Ungrab pointer and unmap window.
virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Process messages for TGColorPopup.
TGColorPopup(const TGColorPopup &)=delete
Pixel_t fCurrentColor
currently selected color value
Int_t fLaunchDialog
flag used for launching color dialog
void PreviewColor(Pixel_t color)
Emit a signal to see preview.
Int_t fActive
active color index
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
TGColorPopup * fColorPopup
color popup associated
TGGC fDrawGC
drawing GC
virtual void AlphaColorSelected(ULong_t colptr=0)
Pixel_t fColor
color value of the button
virtual ~TGColorSelect()
TGColorSelect destructor.
virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Process messages for TGColorSelect.
TGColorSelect(const TGColorSelect &)=delete
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
TGPosition fPressPos
position of frame on button press event
void Enable(Bool_t on=kTRUE)
Set state of widget as enabled.
virtual void ColorSelected(Pixel_t color=0)
void SetAlphaColor(ULong_t color, Bool_t emit=kTRUE)
Set color.
void Disable()
Set state of widget as disabled.
virtual Bool_t HandleButton(Event_t *event)
Handle button events for TGColorSelect.
Pixel_t GetColor() const
void DrawTriangle(GContext_t gc, Int_t x, Int_t y)
Draw triangle (arrow) on which user can click to open TGColorPopup.
virtual void DoRedraw()
Redraw TGColorSelect widget.
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a color select widget as a C++ statement(s) on output stream out.
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition TGFrame.cxx:1000
virtual TGFrame * GetFrameFromPoint(Int_t x, Int_t y)
Get frame located at specified point.
Definition TGFrame.cxx:1308
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:312
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:967
virtual void Layout()
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
virtual Bool_t TranslateCoordinates(TGFrame *child, Int_t x, Int_t y, Int_t &fx, Int_t &fy)
Translate coordinates to child frame.
Definition TGFrame.cxx:1332
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:314
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1022
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:339
virtual void DoRedraw()
Redraw the frame.
Definition TGFrame.cxx:430
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:735
Int_t fX
frame x position
Definition TGFrame.h:85
virtual void MapRaised()
map raised
Definition TGFrame.h:205
UInt_t fHeight
frame height
Definition TGFrame.h:88
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:191
virtual void Draw3dRectangle(UInt_t type, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw 3D rectangle on the frame border.
Definition TGFrame.cxx:357
Int_t fBorderWidth
frame border width
Definition TGFrame.h:93
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:755
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:312
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
Int_t fY
frame y position
Definition TGFrame.h:86
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:645
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:765
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:605
UInt_t fWidth
frame width
Definition TGFrame.h:87
virtual Bool_t HandleButton(Event_t *)
Definition TGFrame.h:161
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition TGFrame.cxx:629
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:775
virtual void UnmapWindow()
unmap window
Definition TGFrame.h:206
void SetForeground(Pixel_t v)
Set foreground color.
Definition TGGC.cxx:278
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
This layout managers does not make use of TGLayoutHints.
Definition TGLayout.h:269
TGClient * fClient
Connection to display server.
Definition TGObject.h:27
Handle_t GetId() const
Definition TGObject.h:37
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:26
Int_t fY
y position
Definition TGDimension.h:39
Int_t fX
x position
Definition TGDimension.h:38
const TGGC * GetFrameGC() const
Cursor_t GetGrabCursor() const
Yield an action as soon as it is clicked.
Definition TGButton.h:142
Int_t fWidgetId
the widget id (used for event processing)
Definition TGWidget.h:46
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
Bool_t HasFocus() const
Definition TGWidget.h:70
Int_t ClearFlags(Int_t flags)
Definition TGWidget.h:59
Int_t SetFlags(Int_t flags)
Definition TGWidget.h:58
const TGWindow * fMsgWindow
window which handles widget events
Definition TGWidget.h:48
Bool_t IsEnabled() const
Definition TGWidget.h:69
Int_t WidgetId() const
Definition TGWidget.h:68
Bool_t WantFocus() const
Definition TGWidget.h:71
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:336
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
@ kEditDisable
disable edit of this window
Definition TGWindow.h:50
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2336
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174
Point structure (maps to the X11 XPoint structure)
Definition GuiTypes.h:356
Short_t fX
Definition GuiTypes.h:357
Attributes that can be used when creating or changing a window.
Definition GuiTypes.h:93
Bool_t fOverrideRedirect
boolean value for override-redirect
Definition GuiTypes.h:107
Mask_t fMask
bit mask specifying which fields are valid
Definition GuiTypes.h:110
auto * m
Definition textangle.C:8