Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGFontDialog.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id: bcc7b53cab203466d39a6f17445d822d6fc19610 $
2// Author: Bertrand Bellenot + Fons Rademakers + Valeriy Onuchin 23/04/03
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
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#include "TGFontDialog.h"
24#include "TString.h"
25#include "TError.h"
26#include "TGColorSelect.h"
27#include "TGButton.h"
28#include "TGLabel.h"
29#include "TGListBox.h"
30#include "TGComboBox.h"
31#include "TVirtualX.h"
32#include <cstdlib>
33
34
46
47static const char *gFDLG_DEFAULTSAMPLE = "AaBbCcYyZz 1234567890";
48
49
50static const char *gFontSizes[] = {
51 "8", "9", "10", "11", "12", "13", "14", "16",
52 "18", "20", "22", "24", "26", "28", "30", "32",
53 "34", "36", "48", "72", 0
54};
55
56static const char *gFontStyles[] = {
57 "Normal", "Bold", "Italic", "Bold Italic", 0
58};
59
61
62
63static const char *gAlignTypes[] = {
64 "top left", "top center", "top right",
65 "middle left", "middle center", "middle right",
66 "bottom left", "bottom center", "bottom right",
67 0
68};
69
82
83
84/** \class TGFontDialog
85 \ingroup guiwidgets
86
87Font selection dialog, allowing to select one in the list of available fonts in the system.
88
89*/
90
91
92
93////////////////////////////////////////////////////////////////////////////////
94/// Create font dialog. When closed via OK button fontProp is set to
95/// the newly selected font. If closed via Cancel button or WM close box
96/// fontProp->fName == "".
97
100 char **fontList, Bool_t wait) :
101 TGTransientFrame(p, t, 100, 100), fFontNames(0), fFontSizes(0), fFontStyles(0),
102 fTextAligns(0), fColorSelect(0), fFontProp(0), fItalic(0), fBold(0), fSize(0),
103 fTextAlign(0), fTextColor(0), fNumberOfFonts(0)
104{
105 TGLabel *lbl;
108 Int_t i, w;
109 UInt_t width = 0, height = 0;
110
111 fSampleTextGC = 0;
112 fLabelFont = 0;
113 fSample = 0;
114 fHitOK = kFALSE;
115 fWaitFor = wait;
116 fInitFont = 0;
117 fInitColor = 0;
118 fInitAlign = 0;
119
120 if (!fontProp) {
121 Error("TGFontDialog", "fontProp argument may not be 0");
122 return;
123 }
125
128
130 if (fontProp->fName == "") {
131 fName = fontList ? fontList[0] : "Arial";
132 fItalic = kFALSE;
133 fBold = kFALSE;
134 fSize = 12;
135 fTextAlign = gAlignValues[6]; //kTextBottom | kTextLeft
137 } else {
138 fName = fontProp->fName;
139 fItalic = fontProp->fItalic;
140 fBold = fontProp->fBold;
141 fSize = fontProp->fSize;
142 fTextAlign = fontProp->fAlign;
143 fTextColor = fontProp->fColor;
144 }
145
146 hf = new TGHorizontalFrame(this, 10, 10);
148
149 //--------------------- font names listbox
150
151 vf = new TGVerticalFrame(hf, 10, 10);
152
153 lbl = new TGLabel(vf, new TGString("Font:"));
154 vf->AddFrame(lbl, lh2);
155
158
159 if (gVirtualX->InheritsFrom("TGX11") || gVirtualX->InheritsFrom("TGCocoa")) {
160 fFontNames->Connect("Selected(char*)", "TGFontDialog", this, "UpdateStyleSize(char*)");
161 }
162
163 fFontNames->Associate(this);
165
167 0, 10, 2, 2));
168
169 //--------------------- font styles listbox
170
171 vf = new TGVerticalFrame(hf, 10, 10);
172
173 lbl = new TGLabel(vf, new TGString("Style:"));
174 vf->AddFrame(lbl, lh2);
175
178 fFontStyles->Associate(this);
179 vf->AddFrame(fFontStyles, lh1);
180
182 0, 10, 2, 2));
183
184 //--------------------- font sizes listbox
185
186 vf = new TGVerticalFrame(hf, 10, 10);
187
188 lbl = new TGLabel(vf, new TGString("Size:"));
189 vf->AddFrame(lbl, lh2);
190
193 fFontSizes->Associate(this);
194 vf->AddFrame(fFontSizes, lh1);
195
197 0, 0, 2, 2));
198
199 //--------------------- Text align and color
200
201 vf = new TGVerticalFrame(hf, 10, 10);
202
203 lbl = new TGLabel(vf, new TGString("Text Align :"));
204 vf->AddFrame(lbl, new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
205
207 fTextAligns->Associate(this);
209 kLHintsExpandX, 5, 5, 0, 5));
210
211 fTextAligns->Resize(110, 20);
212
213 vf->Layout();
214 vf->Resize(vf->GetDefaultSize());
215
216 w = hf->GetDefaultWidth();
217
218 hf2 = new TGHorizontalFrame(vf, 10, 10);
219 vf->AddFrame(hf2, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 5));
220
221 lbl = new TGLabel(hf2, new TGString("Text Color"));
222 hf2->AddFrame(lbl, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 20, 5));
223
225 fColorSelect->Associate(this);
226
227 hf2->AddFrame(fColorSelect, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 20, 5));
228
229 vf->Resize(vf->GetDefaultSize());
230
232 10, 0, lbl->GetDefaultHeight()+6, 0));
233
234 //--------------------- initialize controls
235
237
238 Int_t cnt = 0;
239 Bool_t own = kFALSE;
240
241 if (!fontList) {
242 fontList = gVirtualX->ListFonts("-*-*-*-*", 10000, cnt);
243 own = kTRUE;
244 }
245
246 Build(fontList, cnt);
247
248 for (i = 0; gAlignTypes[i] != 0; ++i) {
250 }
251
252 for (i = 0; gAlignValues[i] != 0; ++i) {
253 if (gAlignValues[i] == fTextAlign) {
255 }
256 }
257
258 TGLBEntry *entry = fTextAligns->FindEntry("bottom center");
259 if (entry)
260 fTextAligns->Resize(entry->GetWidth() + 20, entry->GetHeight() > 20 ?
261 entry->GetHeight() : 20);
262
263 vf->Layout();
264 vf->Resize(vf->GetDefaultSize());
265
266 //--------------------- sample box
267
268 hf = new TGHorizontalFrame(this, 10, 10);
270
271 TGGroupFrame *gf = new TGGroupFrame(hf, new TGString("Sample"));
272 hf->AddFrame(gf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 3, 3, 3, 3));
273
277 1, 1, 3, 1));
278
279 if (sample == "")
281 else
283
284 for (i = 0; gFontSizes[i] != 0; ++i) {
285 if (fSize == atoi(gFontSizes[i])) {
286 fFontSizes->Select(i);
287 break;
288 }
289 }
290
291 if ((fBold == kFALSE) && (fItalic == kFALSE))
293 if ((fBold == kTRUE) && (fItalic == kFALSE))
295 if ((fBold == kFALSE) && (fItalic == kTRUE))
297 if ((fBold == kTRUE) && (fItalic == kTRUE))
299
300 GetFontName(); //sets fLName and other data members
301
303 gcval.fMask = kGCForeground | kGCFont;
304 gcval.fForeground = fTextColor;
305 gcval.fFont = fLabelFont->GetFontHandle();
307 fSample = new TGLabel(cf, fSampleText); //, (*fSampleTextGC)(), (*fLabelFont)());
311 1, 1, 1, 1));
312 cf->Layout();
313 if (own) gVirtualX->FreeFontNames(fontList);
314
315 gf->Resize(w, 80);
316
317 //--------------------- OK and Cancel buttons
318
319 vf = new TGVerticalFrame(hf, 10, 10, kFixedWidth);
320
321 TGTextButton *ok = new TGTextButton(vf, new TGHotString("&OK"), kFDLG_OK);
322 ok->Associate(this);
323 vf->AddFrame(ok, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 20, 5));
324
326 cancel->Associate(this);
327 vf->AddFrame(cancel, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
328
329 vf->Resize(cancel->GetDefaultWidth()+70, vf->GetDefaultHeight());
330
331 hf->AddFrame(vf, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
333
337
338 fFontNames->GetScrollBar()->SetPosition(fFontNames->GetSelected()-3);
339 fFontSizes->GetScrollBar()->SetPosition(fFontSizes->GetSelected()-3);
342
343 SetWindowName("Font Selection");
344 SetIconName("Font Selection");
345 SetClassHints("ROOT", "FontDialog");
346
352
353 //---- set minimum size to the dialog box
358
359 //---- position the dialog relative to the parent's window
361
362 // set minimum size
364 SetWMSizeHints(width, height, 10000, 10000, 0, 0);
365
366 if (fWaitFor) {
367 MapWindow();
368 fClient->WaitForUnmap(this);
369 DeleteWindow();
370 }
371}
372
373////////////////////////////////////////////////////////////////////////////////
374/// Delete all widgets.
375
377{
378 //fClient->FreeFont(fLabelFont);
380}
381
382////////////////////////////////////////////////////////////////////////////////
383/// Called when window is closed via window manager.
384
386{
387 if (fWaitFor) {
388 UnmapWindow();
389 return;
390 }
391
392 if (!fHitOK) {
393 fFontProp->fName = "";
394
395 if (fInitFont) {
397 FontSelected((char*)fInitFont->GetName());
398 }
399 if (fInitColor) {
402 }
403
404 if (fInitAlign) {
407 }
408 }
409 fFontNames->Select(0);
411 fFontSizes->Select(0);
412
413 // don't call DeleteWindow() here since that will cause access
414 // to the deleted dialog in the WaitFor() method (see ctor)
415 UnmapWindow();
416}
417
418////////////////////////////////////////////////////////////////////////////////
419/// Handle dialog events.
420
422{
423 switch (GET_MSG(msg)) {
424 case kC_COMMAND:
425 switch (GET_SUBMSG(msg)) {
426 case kCM_BUTTON:
427 switch (parm1) {
428
429 case kFDLG_OK:
430 fHitOK = kTRUE;
437 CloseWindow();
438 break;
439 case kFDLG_CANCEL:
440 fHitOK = kFALSE;
441 CloseWindow();
442 break;
443 }
444 break;
445
446 case kCM_LISTBOX:
447 GetFontName();
448 break;
449
450 case kCM_COMBOBOX:
451 GetFontName();
452 break;
453
454 default:
455 break;
456 }
457 break;
458
459 case kC_COLORSEL:
460 switch (GET_SUBMSG(msg)) {
461
462 case kCOL_SELCHANGED:
463 {
464 if (parm2 != (Int_t)fTextColor) {
466 GetFontName();
467 }
468 }
469 break;
470
471 default:
472 break;
473 }
474 break;
475
476 default:
477 break;
478 }
479 return kTRUE;
480}
481
482////////////////////////////////////////////////////////////////////////////////
483/// Build font dialog.
484
486{
487 TString family;
488 TString font;
489
490 Int_t i;
491 fNumberOfFonts = 1;
492 Int_t n1, n2;
493
494 for (i = 0; i < cnt; i++) {
495 font = fontList[i];
496 n1 = font.Index("-", 1);
497 n2 = font.Index("-", n1+1);
498 family = font(n1+1, n2-n1-1);
499
500 if ((family.Length() == 0) || (family.BeginsWith("@"))) {
501 continue;
502 }
503
504 if (!fFontNames->FindEntry(family.Data())) {
506 }
507 }
508
510
512
513 if (le) {
514 fFontNames->Select(le->EntryId());
515 }
516
518
519 return kTRUE;
520}
521
522////////////////////////////////////////////////////////////////////////////////
523/// Build font style and size list boxes
524
525void TGFontDialog::UpdateStyleSize(const char *family)
526{
527 if (!family) {
528 return;
529 }
530
531 TString font = family;
532 Bool_t styles[4] = { kFALSE, kFALSE, kFALSE, kFALSE };
533 Int_t cnt = 0;
534 Int_t i = 0;
535
537 char **fontList = 0;
538
539 fname = TString::Format("-*-%s-*-*", family);
540 fontList = gVirtualX->ListFonts(fname.Data(), 1000, cnt);
541
542 fFontSizes->RemoveEntries(0, 1000);
544
545 fFontStyles->RemoveEntries(0, 100);
547
548 if (!cnt || !fontList) {
549 return;
550 }
551
554 TString sz;
556 Int_t n1, n2;
557 Bool_t x11 = gVirtualX->InheritsFrom("TGX11");
558 Bool_t all_sizes = !x11;
559 Bool_t all_styles = !x11;
560
561 //
562 if (gVirtualX->InheritsFrom("TGCocoa")) {
565 }
566
567 int szn = 0;
568
569 fFontSizes->AddEntry("12", szn++);
570
571 for (i = 0; i < cnt; i++) {
572 name = fontList[i];
573 n1 = name.Index(family);
574
575 if (n1 == kNPOS) {
576 break;
577 }
578 n1 += font.Length() + 1;
579 n2 = name.Index("-", n1);
580 if (n2 == kNPOS) {
581 break;
582 }
583
584 style1 = name(n1, n2 - n1);
585
586 n1 = n2 + 1;
587 n2 = name.Index("-", n1);
588 if (n2 == kNPOS) {
589 break;
590 }
591 style2 = name(n1, n2 - n1);
592
593 if ((style1 == "normal") || (style1 == "medium")) {
594 if (style2 == "r") {
595 styles[0] = kTRUE;
596 gFontStylesReal[0] = style1 + "-" + style2;
597 } else if (style2 == "i") {
598 styles[2] = kTRUE;
599 gFontStylesReal[2] = style1 + "-" + style2;
600 } else if (style2 == "o") {
601 styles[2] = kTRUE;
602 gFontStylesReal[2] = style1 + "-" + style2;
603 }
604 } else if (style1 == "bold") {
605 if (style2 == "r") {
606 styles[1] = kTRUE;
607 gFontStylesReal[1] = style1 + "-" + style2;
608 } else if (style2 == "i") {
609 styles[3] = kTRUE;
610 gFontStylesReal[3] = style1 + "-" + style2;
611 } else if (style2 == "o") {
612 styles[3] = kTRUE;
613 gFontStylesReal[3] = style1 + "-" + style2;
614 }
615 } else if (style1 == "(null)") {
616 styles[0] = kTRUE;
617 gFontStylesReal[0] = "normal-r";
618 styles[1] = kTRUE;
619 gFontStylesReal[1] = "bold-r";
620 styles[2] = kTRUE;
621 gFontStylesReal[2] = "normal-i";
622 styles[3] = kTRUE;
623 gFontStylesReal[3] = "bold-i";
624 }
625
626 n1++;
627 n2 = name.Index("-", n1);
628 n1 = n2 + 1;
629 n2 = name.Index("-", n1);
630
631 if (n2 != kNPOS) {
632 n1 = n2 + 2;
633 n2 = name.Index("-", n1);
634 sz = name(n1, n2 - n1);
635 if (!sz.IsDigit()) {
636 continue;
637 }
638
639 all_sizes = (sz == "0") && !x11;
640 if (!all_sizes) {
641 sz.Strip();
642 if (sz.Length() == 1) {
643 sz = " " + sz;
644 }
645 if (!fFontSizes->FindEntry(sz.Data())) {
646 fFontSizes->AddEntry(sz.Data(), szn++);
647 }
648 }
649 }
650 }
651 gVirtualX->FreeFontNames(fontList);
652
654 for (i = 0; gFontStyles[i] != 0; ++i) {
655 if (all_styles || styles[i]) {
658 }
659 }
660
661 if (nostyles && x11) {
663 fBold = kFALSE;
664 fItalic = kFALSE;
665 }
666
667 if (!fBold) {
668 if (!fItalic) {
670 } else {
672 }
673 } else {
674 if (!fItalic) {
676 } else {
678 }
679 }
680
681// if (nostyles) {
682// fFontNames->RemoveEntry(fFontNames->FindEntry(family)->EntryId());
683// }
684
687//
688
689 sz = TString::Format("%d", fSize);
690 if (sz.Length() == 1) {
691 sz = " " + sz;
692 }
693
694 for (i = 0; gFontSizes[i] != 0; ++i) {
697 }
698 if (sz == gFontSizes[i]) {
699 fFontSizes->Select(i);
700 }
701 }
702
706}
707
708////////////////////////////////////////////////////////////////////////////////
709/// Sets fLName and other data members.
710
712{
714 const char *size, *name;
715 Int_t sel;
718
721
722 if (!e) {
723 fFontNames->Select(1);
725 }
726 name = e ? e->GetText()->GetString() : "";
727 fName = name;
728
730 size = e ? e->GetText()->GetString() : "0";
731 fSize = atoi(size);
732
734 if (sel < 0) sel = 0;
735
736 switch(sel) {
737 case 0:
738 fItalic = kFALSE;
739 fBold = kFALSE;
740 break;
741 case 1:
742 fItalic = kFALSE;
743 fBold = kTRUE;
744 break;
745 case 2:
746 fItalic = kTRUE;
747 fBold = kFALSE;
748 break;
749 case 3:
750 fItalic = kTRUE;
751 fBold = kTRUE;
752 break;
753 default:
754 fItalic = kFALSE;
755 fBold = kFALSE;
756 break;
757 }
758
759 const char *rgstry = "*";
760
761 if ((fName == "Symbol") || (fName == "Webdings") || (fName == "Wingdings")) {
762 rgstry = "microsoft";
763 }
764
766 fLName = TString::Format("-*-%s-%s-*-*-%s-*-*-*-*-*-%s-*", name,
767 gFontStylesReal[sel].Data(), size, rgstry);
768
769 if (oldFont != fLName) {
770 if (fLabelFont) {
771 //fClient->FreeFont(fLabelFont);
773
774 if (!fLabelFont) {
775 fLabelFont = fClient->GetFont("fixed");
776 }
777 } else {
778 fLabelFont = fClient->GetFont("fixed");
779 }
780
781 if (!fLabelFont) {
782 // should not happen
783 fLName = oldFont;
784 }
785 else if (fSample) {
787 }
788 }
789
791
793 fTextAlign = gAlignValues[idx >= 0 ? idx : 6];
794
795 if (fSample) {
796 if (fTextAlign != oldAlign) {
799 }
803 }
804 FontSelected((char*)fLName.Data());
805 fClient->NeedRedraw(this);
807}
808
809////////////////////////////////////////////////////////////////////////////////
810/// Set font
811
813{
814 if (!font) {
815 return;
816 }
817 TString name = font->GetName();
818
819 if (name.Index("-", 1) == kNPOS) {
820 return;
821 }
822
823 if (fSample) {
824 fLabelFont = font;
826 }
827 fInitFont = font;
828
831 TString sz;
832
833 TString family;
834 Int_t n1, n2;
835
836 n1 = name.Index("-", 1);
837 n2 = name.Index("-", n1 + 1);
838 n1++;
839 family = name(n1, n2 - n1);
840
842
843 if (le) {
844 fFontNames->Select(le->EntryId());
845 }
846
847 n1 = n2 + 1;
848 n2 = name.Index("-", n1);
849
850 style1 = name(n1, n2 - n1);
851
852 n1 = n2 + 1;
853 n2 = name.Index("-", n1);
854 if (n2 == kNPOS) {
855 return;
856 }
857 style2 = name(n1, n2 - n1);
858
859 if ((style1 == "normal") || (style1 == "medium")) {
860 if (style2 == "r") {
862 } else if (style2 == "i") {
864 } else if (style2 == "o") {
866 }
867 } else if (style1 == "bold") {
868 if (style2 == "r") {
870 } else if (style2 == "i") {
872 } else if (style2 == "o") {
874 }
875 }
876 n1++;
877 n2 = name.Index("-", n1);
878 n1 = n2 + 1;
879 n2 = name.Index("-", n1);
880 n1 = n2 + 1;
881 n2 = name.Index("-", n1);
882 if (n2 != kNPOS) {
883 n1 = n2 + 1;
884 n2 = name.Index("-", n1);
885 sz = name(n1, n2 - n1);
886
888 if (le) {
889 fFontSizes->Select(le->EntryId());
890 }
891 }
892}
893
894////////////////////////////////////////////////////////////////////////////////
895/// Set color
896
898{
899 if (fSample) {
900 fTextColor = color;
902 }
905 fInitColor = color;
906}
907
908////////////////////////////////////////////////////////////////////////////////
909/// Set align
910
912{
913 if (fSample) {
914 fTextAlign = align;
916 }
917
918 for (int i = 0; gAlignValues[i] != 0; ++i) {
919 if (gAlignValues[i] == align) {
921 }
922 }
923 fInitAlign = align;
925}
926
927////////////////////////////////////////////////////////////////////////////////
928/// Enable/disable align combobox
929
dim_t fSize
const Mask_t kGCForeground
Definition GuiTypes.h:288
const Mask_t kGCFont
Definition GuiTypes.h:300
@ kSunkenFrame
Definition GuiTypes.h:383
@ kFixedWidth
Definition GuiTypes.h:387
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:89
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
Definition RtypesCore.h:131
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
constexpr Int_t kFatal
Definition TError.h:50
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
Int_t gErrorIgnoreLevel
errors with level below this value will be ignored. Default is kUnset.
Definition TError.cxx:33
static const char * gFontStyles[]
static const char * gAlignTypes[]
static const Int_t gAlignValues[]
static const char * gFDLG_DEFAULTSAMPLE
static const char * gFontSizes[]
static TString gFontStylesReal[4]
EFontDialog
@ kFDLG_FONTSIZES
@ kFDLG_FONTALIGNS
@ kFDLG_COLORSEL
@ kFDLG_CANCEL
@ kFDLG_OK
@ kFDLG_FONTSTYLES
@ kFDLG_FONTNAMES
@ kMWMDecorResizeH
Definition TGFrame.h:65
@ kMWMFuncAll
Definition TGFrame.h:49
@ kMWMFuncResize
Definition TGFrame.h:50
@ kMWMDecorMaximize
Definition TGFrame.h:69
@ kMWMDecorMinimize
Definition TGFrame.h:68
@ kMWMDecorMenu
Definition TGFrame.h:67
@ kMWMDecorAll
Definition TGFrame.h:63
@ kMWMFuncMaximize
Definition TGFrame.h:53
@ kMWMInputModeless
Definition TGFrame.h:57
@ kMWMFuncMinimize
Definition TGFrame.h:52
@ kDeepCleanup
Definition TGFrame.h:42
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsNormal
Definition TGLayout.h:32
@ kLHintsCenterX
Definition TGLayout.h:25
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
@ kTextCenterX
Definition TGWidget.h:25
@ kTextLeft
Definition TGWidget.h:23
@ kTextBottom
Definition TGWidget.h:27
@ kTextTop
Definition TGWidget.h:26
@ kTextRight
Definition TGWidget.h:24
@ kTextCenterY
Definition TGWidget.h:28
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize UnmapWindow
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetMWMHints
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t SetWMSizeHints
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:110
#define gVirtualX
Definition TVirtualX.h:337
Int_t GET_MSG(Long_t val)
@ kCM_COMBOBOX
@ kCOL_SELCHANGED
@ kC_COLORSEL
@ kC_COMMAND
@ kCM_BUTTON
@ kCM_LISTBOX
Int_t GET_SUBMSG(Long_t val)
void WaitForUnmap(TGWindow *w)
Wait for window to be unmapped.
Definition TGClient.cxx:745
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get graphics context from the gc pool.
Definition TGClient.cxx:328
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition TGClient.cxx:356
void FreeGC(const TGGC *gc)
Free a graphics context.
Definition TGClient.cxx:336
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:380
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual Int_t GetSelected() const
Definition TGComboBox.h:114
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:86
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
virtual void SetEnabled(Bool_t on=kTRUE)
Set state of combo box. If kTRUE=enabled, kFALSE=disabled.
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:318
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
UInt_t GetDefaultWidth() const override
Definition TGFrame.h:314
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1156
UInt_t GetDefaultHeight() const override
Definition TGFrame.h:316
TGCompositeFrame(const TGCompositeFrame &)=delete
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1064
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1014
TGGC * fSampleTextGC
GC used for sample text.
Pixel_t fTextColor
text color
virtual void AlignSelected(Int_t a)
void CloseWindow() override
Called when window is closed via window manager.
Bool_t Build(char **fontList, Int_t cnt)
Build font dialog.
virtual void SetAlign(Int_t align)
Set align.
TGListBox * fFontSizes
list of font sizes
Int_t fTextAlign
text alignment
Int_t fSize
font size
Bool_t fBold
bold flag
TString fSampleText
string used for sample
Bool_t fHitOK
flag = kTRUE if user press the Ok button
TGLabel * fSample
sample of selected font
TGFont * fLabelFont
TGFont used for sample text.
TGListBox * fFontStyles
list of font styles
Bool_t fWaitFor
if kTRUE WaitForUnmap is called in constructor.
Pixel_t fInitColor
initial value of text color
FontProp_t * fFontProp
font info structure
virtual void FontSelected(char *font)
TString fName
font name
virtual void UpdateStyleSize(const char *family)
Build font style and size list boxes.
virtual void SetFont(TGFont *font)
Set font.
Bool_t fItalic
italic flag
~TGFontDialog() override
Delete all widgets.
virtual void EnableAlign(Bool_t on=kTRUE)
Enable/disable align combobox.
void GetFontName()
Sets fLName and other data members.
TGFont * fInitFont
initial font
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Handle dialog events.
TGColorSelect * fColorSelect
color selection dialog
Int_t fInitAlign
initial value of text align
TGFontDialog(const TGWindow *parent=nullptr, const TGWindow *t=nullptr, FontProp_t *fontProp=nullptr, const TString &sample="", char **fontList=nullptr, Bool_t wait=kTRUE)
Create font dialog.
virtual void SetColor(Pixel_t color)
Set color.
Int_t fNumberOfFonts
total number of fonts
TGListBox * fFontNames
list of font names
TGComboBox * fTextAligns
font alignment selection
virtual void ColorSelected(Pixel_t c)
TString fLName
logical font name
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
FontH_t GetFontHandle() const
Definition TGFont.h:183
static Pixel_t GetBlackPixel()
Get black pixel value.
Definition TGFrame.cxx:714
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
void MapWindow() override
map window
Definition TGFrame.h:206
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:268
A composite frame with a border and a title.
Definition TGFrame.h:524
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
Basic listbox entries.
Definition TGListBox.h:24
This class handles GUI labels.
Definition TGLabel.h:24
void SetTextJustify(Int_t tmode)
Set text justification.
Definition TGLabel.cxx:395
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition TGLabel.cxx:361
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
Definition TGLabel.cxx:323
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
A listbox is a box, possibly with scrollbar, containing entries.
Definition TGListBox.h:221
virtual void SortByName(Bool_t ascend=kTRUE)
Sort entries by name.
virtual TGLBEntry * Select(Int_t id, Bool_t sel=kTRUE)
Definition TGListBox.h:284
virtual TGLBEntry * GetSelectedEntry() const
Definition TGListBox.h:288
void Resize(UInt_t w, UInt_t h) override
Resize the listbox widget.
virtual Int_t GetSelected() const
Return id of selected listbox item.
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
void Layout() override
Layout the listbox components.
virtual TGScrollBar * GetScrollBar() const
Definition TGListBox.h:269
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
Remove a range of entries defined by from_ID and to_ID.
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1850
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1793
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition TGFrame.cxx:1885
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1780
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
Yield an action as soon as it is clicked.
Definition TGButton.h:142
Text string listbox entries.
Definition TGListBox.h:48
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:500
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition TGFrame.cxx:1949
A composite frame that layout their children in vertical way.
Definition TGFrame.h:376
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
ROOT GUI Window base class.
Definition TGWindow.h:23
@ kEditDisable
disable edit of this window
Definition TGWindow.h:57
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:865
Basic string class.
Definition TString.h:138
Ssiz_t Length() const
Definition TString.h:425
const char * Data() const
Definition TString.h:384
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:631
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:2384
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:659
Graphics context structure.
Definition GuiTypes.h:224
TString fName
font name
Bool_t fBold
bold flag
Pixel_t fColor
text color
Bool_t fItalic
italic flag
UInt_t fAlign
text alignment