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
38
43
45};
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
70static const Int_t gAlignValues[] = {
80 0
81};
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
93
94////////////////////////////////////////////////////////////////////////////////
95/// Create font dialog. When closed via OK button fontProp is set to
96/// the newly selected font. If closed via Cancel button or WM close box
97/// fontProp->fName == "".
98
100 FontProp_t *fontProp, const TString &sample,
101 char **fontList, Bool_t wait) :
102 TGTransientFrame(p, t, 100, 100), fFontNames(0), fFontSizes(0), fFontStyles(0),
103 fTextAligns(0), fColorSelect(0), fFontProp(0), fItalic(0), fBold(0), fSize(0),
104 fTextAlign(0), fTextColor(0), fNumberOfFonts(0)
105{
106 TGLabel *lbl;
107 TGHorizontalFrame *hf, *hf2;
108 TGVerticalFrame *vf;
109 Int_t i, w;
110 UInt_t width = 0, height = 0;
111
112 fSampleTextGC = 0;
113 fLabelFont = 0;
114 fSample = 0;
115 fHitOK = kFALSE;
116 fWaitFor = wait;
117 fInitFont = 0;
118 fInitColor = 0;
119 fInitAlign = 0;
120
121 if (!fontProp) {
122 Error("TGFontDialog", "fontProp argument may not be 0");
123 return;
124 }
126
128 TGLayoutHints *lh2 = new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 0, 2, 2);
129
130 fFontProp = fontProp;
131 if (fontProp->fName == "") {
132 fName = fontList ? fontList[0] : "Arial";
133 fItalic = kFALSE;
134 fBold = kFALSE;
135 fSize = 12;
136 fTextAlign = gAlignValues[6]; //kTextBottom | kTextLeft
138 } else {
139 fName = fontProp->fName;
140 fItalic = fontProp->fItalic;
141 fBold = fontProp->fBold;
142 fSize = fontProp->fSize;
143 fTextAlign = fontProp->fAlign;
144 fTextColor = fontProp->fColor;
145 }
146
147 hf = new TGHorizontalFrame(this, 10, 10);
148 AddFrame(hf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5));
149
150 //--------------------- font names listbox
151
152 vf = new TGVerticalFrame(hf, 10, 10);
153
154 lbl = new TGLabel(vf, new TGString("Font:"));
155 vf->AddFrame(lbl, lh2);
156
159
160 if (gVirtualX->InheritsFrom("TGX11") || gVirtualX->InheritsFrom("TGCocoa")) {
161 fFontNames->Connect("Selected(char*)", "TGFontDialog", this, "UpdateStyleSize(char*)");
162 }
163
164 fFontNames->Associate(this);
166
168 0, 10, 2, 2));
169
170 //--------------------- font styles listbox
171
172 vf = new TGVerticalFrame(hf, 10, 10);
173
174 lbl = new TGLabel(vf, new TGString("Style:"));
175 vf->AddFrame(lbl, lh2);
176
179 fFontStyles->Associate(this);
180 vf->AddFrame(fFontStyles, lh1);
181
183 0, 10, 2, 2));
184
185 //--------------------- font sizes listbox
186
187 vf = new TGVerticalFrame(hf, 10, 10);
188
189 lbl = new TGLabel(vf, new TGString("Size:"));
190 vf->AddFrame(lbl, lh2);
191
194 fFontSizes->Associate(this);
195 vf->AddFrame(fFontSizes, lh1);
196
198 0, 0, 2, 2));
199
200 //--------------------- Text align and color
201
202 vf = new TGVerticalFrame(hf, 10, 10);
203
204 lbl = new TGLabel(vf, new TGString("Text Align :"));
205 vf->AddFrame(lbl, new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
206
208 fTextAligns->Associate(this);
210 kLHintsExpandX, 5, 5, 0, 5));
211
212 fTextAligns->Resize(110, 20);
213
214 vf->Layout();
215 vf->Resize(vf->GetDefaultSize());
216
217 w = hf->GetDefaultWidth();
218
219 hf2 = new TGHorizontalFrame(vf, 10, 10);
220 vf->AddFrame(hf2, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 5));
221
222 lbl = new TGLabel(hf2, new TGString("Text Color"));
223 hf2->AddFrame(lbl, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 20, 5));
224
226 fColorSelect->Associate(this);
227
229
230 vf->Resize(vf->GetDefaultSize());
231
233 10, 0, lbl->GetDefaultHeight()+6, 0));
234
235 //--------------------- initialize controls
236
238
239 Int_t cnt = 0;
240 Bool_t own = kFALSE;
241
242 if (!fontList) {
243 fontList = gVirtualX->ListFonts("-*-*-*-*", 10000, cnt);
244 own = kTRUE;
245 }
246
247 Build(fontList, cnt);
248
249 for (i = 0; gAlignTypes[i] != 0; ++i) {
251 }
252
253 for (i = 0; gAlignValues[i] != 0; ++i) {
254 if (gAlignValues[i] == fTextAlign) {
256 }
257 }
258
259 TGLBEntry *entry = fTextAligns->FindEntry("bottom center");
260 if (entry)
261 fTextAligns->Resize(entry->GetWidth() + 20, entry->GetHeight() > 20 ?
262 entry->GetHeight() : 20);
263
264 vf->Layout();
265 vf->Resize(vf->GetDefaultSize());
266
267 //--------------------- sample box
268
269 hf = new TGHorizontalFrame(this, 10, 10);
270 AddFrame(hf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 5, 5, 5));
271
272 TGGroupFrame *gf = new TGGroupFrame(hf, new TGString("Sample"));
273 hf->AddFrame(gf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 3, 3, 3, 3));
274
275 TGCompositeFrame *cf = new TGCompositeFrame(gf, 200, 100, kSunkenFrame);
278 1, 1, 3, 1));
279
280 if (sample == "")
282 else
283 fSampleText = sample;
284
285 for (i = 0; gFontSizes[i] != 0; ++i) {
286 if (fSize == atoi(gFontSizes[i])) {
287 fFontSizes->Select(i);
288 break;
289 }
290 }
291
292 if ((fBold == kFALSE) && (fItalic == kFALSE))
294 if ((fBold == kTRUE) && (fItalic == kFALSE))
296 if ((fBold == kFALSE) && (fItalic == kTRUE))
298 if ((fBold == kTRUE) && (fItalic == kTRUE))
300
301 GetFontName(); //sets fLName and other data members
302
303 GCValues_t gcval;
304 gcval.fMask = kGCForeground | kGCFont;
305 gcval.fForeground = fTextColor;
306 gcval.fFont = fLabelFont->GetFontHandle();
307 fSampleTextGC = fClient->GetGC(&gcval, kTRUE);
308 fSample = new TGLabel(cf, fSampleText); //, (*fSampleTextGC)(), (*fLabelFont)());
312 1, 1, 1, 1));
313 cf->Layout();
314 if (own) gVirtualX->FreeFontNames(fontList);
315
316 gf->Resize(w, 80);
317
318 //--------------------- OK and Cancel buttons
319
320 vf = new TGVerticalFrame(hf, 10, 10, kFixedWidth);
321
322 TGTextButton *ok = new TGTextButton(vf, new TGHotString("&OK"), kFDLG_OK);
323 ok->Associate(this);
324 vf->AddFrame(ok, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 20, 5));
325
326 TGTextButton *cancel = new TGTextButton(vf, new TGHotString("&Cancel"), kFDLG_CANCEL);
327 cancel->Associate(this);
328 vf->AddFrame(cancel, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
329
330 vf->Resize(cancel->GetDefaultWidth()+70, vf->GetDefaultHeight());
331
332 hf->AddFrame(vf, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
334
338
343
344 SetWindowName("Font Selection");
345 SetIconName("Font Selection");
346 SetClassHints("ROOT", "FontDialog");
347
353
354 //---- set minimum size to the dialog box
359
360 //---- position the dialog relative to the parent's window
362
363 // set minimum size
365 SetWMSizeHints(width, height, 10000, 10000, 0, 0);
366
367 if (fWaitFor) {
368 MapWindow();
369 fClient->WaitForUnmap(this);
370 DeleteWindow();
371 }
372}
373
374////////////////////////////////////////////////////////////////////////////////
375/// Delete all widgets.
376
378{
379 //fClient->FreeFont(fLabelFont);
381}
382
383////////////////////////////////////////////////////////////////////////////////
384/// Called when window is closed via window manager.
385
387{
388 if (fWaitFor) {
389 UnmapWindow();
390 return;
391 }
392
393 if (!fHitOK) {
394 fFontProp->fName = "";
395
396 if (fInitFont) {
398 FontSelected((char*)fInitFont->GetName());
399 }
400 if (fInitColor) {
403 }
404
405 if (fInitAlign) {
408 }
409 }
410 fFontNames->Select(0);
412 fFontSizes->Select(0);
413
414 // don't call DeleteWindow() here since that will cause access
415 // to the deleted dialog in the WaitFor() method (see ctor)
416 UnmapWindow();
417}
418
419////////////////////////////////////////////////////////////////////////////////
420/// Handle dialog events.
421
423{
424 switch (GET_MSG(msg)) {
425 case kC_COMMAND:
426 switch (GET_SUBMSG(msg)) {
427 case kCM_BUTTON:
428 switch (parm1) {
429
430 case kFDLG_OK:
431 fHitOK = kTRUE;
438 CloseWindow();
439 break;
440 case kFDLG_CANCEL:
441 fHitOK = kFALSE;
442 CloseWindow();
443 break;
444 }
445 break;
446
447 case kCM_LISTBOX:
448 GetFontName();
449 break;
450
451 case kCM_COMBOBOX:
452 GetFontName();
453 break;
454
455 default:
456 break;
457 }
458 break;
459
460 case kC_COLORSEL:
461 switch (GET_SUBMSG(msg)) {
462
463 case kCOL_SELCHANGED:
464 {
465 if (parm2 != (Int_t)fTextColor) {
466 fTextColor = parm2;
467 GetFontName();
468 }
469 }
470 break;
471
472 default:
473 break;
474 }
475 break;
476
477 default:
478 break;
479 }
480 return kTRUE;
481}
482
483////////////////////////////////////////////////////////////////////////////////
484/// Build font dialog.
485
486Bool_t TGFontDialog::Build(char **fontList, Int_t cnt)
487{
488 TString family;
489 TString font;
490
491 Int_t i;
492 fNumberOfFonts = 1;
493 Int_t n1, n2;
494
495 for (i = 0; i < cnt; i++) {
496 font = fontList[i];
497 n1 = font.Index("-", 1);
498 n2 = font.Index("-", n1+1);
499 family = font(n1+1, n2-n1-1);
500
501 if ((family.Length() == 0) || (family.BeginsWith("@"))) {
502 continue;
503 }
504
505 if (!fFontNames->FindEntry(family.Data())) {
507 }
508 }
509
511
513
514 if (le) {
515 fFontNames->Select(le->EntryId());
516 }
517
519
520 return kTRUE;
521}
522
523////////////////////////////////////////////////////////////////////////////////
524/// Build font style and size list boxes
525
526void TGFontDialog::UpdateStyleSize(const char *family)
527{
528 if (!family) {
529 return;
530 }
531
532 TString font = family;
533 Bool_t styles[4] = { kFALSE, kFALSE, kFALSE, kFALSE };
534 Int_t cnt = 0;
535 Int_t i = 0;
536
537 TString fname;
538 char **fontList = 0;
539
540 fname = TString::Format("-*-%s-*-*", family);
541 fontList = gVirtualX->ListFonts(fname.Data(), 1000, cnt);
542
543 fFontSizes->RemoveEntries(0, 1000);
545
546 fFontStyles->RemoveEntries(0, 100);
548
549 if (!cnt || !fontList) {
550 return;
551 }
552
553 TString style1;
554 TString style2;
555 TString sz;
557 Int_t n1, n2;
558 Bool_t x11 = gVirtualX->InheritsFrom("TGX11");
559 Bool_t all_sizes = !x11;
560 Bool_t all_styles = !x11;
561
562 //
563 if (gVirtualX->InheritsFrom("TGCocoa")) {
564 all_sizes = kTRUE;
565 all_styles = kFALSE;
566 }
567
568 int szn = 0;
569
570 fFontSizes->AddEntry("12", szn++);
571
572 for (i = 0; i < cnt; i++) {
573 name = fontList[i];
574 n1 = name.Index(family);
575
576 if (n1 == kNPOS) {
577 break;
578 }
579 n1 += font.Length() + 1;
580 n2 = name.Index("-", n1);
581 if (n2 == kNPOS) {
582 break;
583 }
584
585 style1 = name(n1, n2 - n1);
586
587 n1 = n2 + 1;
588 n2 = name.Index("-", n1);
589 if (n2 == kNPOS) {
590 break;
591 }
592 style2 = name(n1, n2 - n1);
593
594 if ((style1 == "normal") || (style1 == "medium")) {
595 if (style2 == "r") {
596 styles[0] = kTRUE;
597 gFontStylesReal[0] = style1 + "-" + style2;
598 } else if (style2 == "i") {
599 styles[2] = kTRUE;
600 gFontStylesReal[2] = style1 + "-" + style2;
601 } else if (style2 == "o") {
602 styles[2] = kTRUE;
603 gFontStylesReal[2] = style1 + "-" + style2;
604 }
605 } else if (style1 == "bold") {
606 if (style2 == "r") {
607 styles[1] = kTRUE;
608 gFontStylesReal[1] = style1 + "-" + style2;
609 } else if (style2 == "i") {
610 styles[3] = kTRUE;
611 gFontStylesReal[3] = style1 + "-" + style2;
612 } else if (style2 == "o") {
613 styles[3] = kTRUE;
614 gFontStylesReal[3] = style1 + "-" + style2;
615 }
616 } else if (style1 == "(null)") {
617 styles[0] = kTRUE;
618 gFontStylesReal[0] = "normal-r";
619 styles[1] = kTRUE;
620 gFontStylesReal[1] = "bold-r";
621 styles[2] = kTRUE;
622 gFontStylesReal[2] = "normal-i";
623 styles[3] = kTRUE;
624 gFontStylesReal[3] = "bold-i";
625 }
626
627 n1++;
628 n2 = name.Index("-", n1);
629 n1 = n2 + 1;
630 n2 = name.Index("-", n1);
631
632 if (n2 != kNPOS) {
633 n1 = n2 + 2;
634 n2 = name.Index("-", n1);
635 sz = name(n1, n2 - n1);
636 if (!sz.IsDigit()) {
637 continue;
638 }
639
640 all_sizes = (sz == "0") && !x11;
641 if (!all_sizes) {
642 sz.Strip();
643 if (sz.Length() == 1) {
644 sz = " " + sz;
645 }
646 if (!fFontSizes->FindEntry(sz.Data())) {
647 fFontSizes->AddEntry(sz.Data(), szn++);
648 }
649 }
650 }
651 }
652 gVirtualX->FreeFontNames(fontList);
653
654 Bool_t nostyles = kTRUE;
655 for (i = 0; gFontStyles[i] != 0; ++i) {
656 if (all_styles || styles[i]) {
657 nostyles = kFALSE;
659 }
660 }
661
662 if (nostyles && x11) {
664 fBold = kFALSE;
665 fItalic = kFALSE;
666 }
667
668 if (!fBold) {
669 if (!fItalic) {
671 } else {
673 }
674 } else {
675 if (!fItalic) {
677 } else {
679 }
680 }
681
682// if (nostyles) {
683// fFontNames->RemoveEntry(fFontNames->FindEntry(family)->EntryId());
684// }
685
688//
689
690 sz = TString::Format("%d", fSize);
691 if (sz.Length() == 1) {
692 sz = " " + sz;
693 }
694
695 for (i = 0; gFontSizes[i] != 0; ++i) {
696 if (all_sizes && !fFontSizes->FindEntry(gFontSizes[i])) {
698 }
699 if (sz == gFontSizes[i]) {
700 fFontSizes->Select(i);
701 }
702 }
703
707}
708
709////////////////////////////////////////////////////////////////////////////////
710/// Sets fLName and other data members.
711
713{
715 const char *size, *name;
716 Int_t sel;
719
720 TString oldName = fName;
722
723 if (!e) {
724 fFontNames->Select(1);
726 }
727 name = e ? e->GetText()->GetString() : "";
728 fName = name;
729
731 size = e ? e->GetText()->GetString() : "0";
732 fSize = atoi(size);
733
735 if (sel < 0) sel = 0;
736
737 switch(sel) {
738 case 0:
739 fItalic = kFALSE;
740 fBold = kFALSE;
741 break;
742 case 1:
743 fItalic = kFALSE;
744 fBold = kTRUE;
745 break;
746 case 2:
747 fItalic = kTRUE;
748 fBold = kFALSE;
749 break;
750 case 3:
751 fItalic = kTRUE;
752 fBold = kTRUE;
753 break;
754 default:
755 fItalic = kFALSE;
756 fBold = kFALSE;
757 break;
758 }
759
760 const char *rgstry = "*";
761
762 if ((fName == "Symbol") || (fName == "Webdings") || (fName == "Wingdings")) {
763 rgstry = "microsoft";
764 }
765
766 TString oldFont = fLName;
767 fLName = TString::Format("-*-%s-%s-*-*-%s-*-*-*-*-*-%s-*", name,
768 gFontStylesReal[sel].Data(), size, rgstry);
769
770 if (oldFont != fLName) {
771 if (fLabelFont) {
772 //fClient->FreeFont(fLabelFont);
774
775 if (!fLabelFont) {
776 fLabelFont = fClient->GetFont("fixed");
777 }
778 } else {
779 fLabelFont = fClient->GetFont("fixed");
780 }
781
782 if (!fLabelFont) {
783 // should not happen
784 fLName = oldFont;
785 }
786 else if (fSample) {
788 }
789 }
790
791 Int_t oldAlign = fTextAlign;
792
794 fTextAlign = gAlignValues[idx >= 0 ? idx : 6];
795
796 if (fSample) {
797 if (fTextAlign != oldAlign) {
800 }
804 }
805 FontSelected((char*)fLName.Data());
806 fClient->NeedRedraw(this);
807 gErrorIgnoreLevel = sav;
808}
809
810////////////////////////////////////////////////////////////////////////////////
811/// Set font
812
814{
815 if (!font) {
816 return;
817 }
818 TString name = font->GetName();
819
820 if (name.Index("-", 1) == kNPOS) {
821 return;
822 }
823
824 if (fSample) {
825 fLabelFont = font;
827 }
828 fInitFont = font;
829
830 TString style1;
831 TString style2;
832 TString sz;
833
834 TString family;
835 Int_t n1, n2;
836
837 n1 = name.Index("-", 1);
838 n2 = name.Index("-", n1 + 1);
839 n1++;
840 family = name(n1, n2 - n1);
841
843
844 if (le) {
845 fFontNames->Select(le->EntryId());
846 }
847
848 n1 = n2 + 1;
849 n2 = name.Index("-", n1);
850
851 style1 = name(n1, n2 - n1);
852
853 n1 = n2 + 1;
854 n2 = name.Index("-", n1);
855 if (n2 == kNPOS) {
856 return;
857 }
858 style2 = name(n1, n2 - n1);
859
860 if ((style1 == "normal") || (style1 == "medium")) {
861 if (style2 == "r") {
863 } else if (style2 == "i") {
865 } else if (style2 == "o") {
867 }
868 } else if (style1 == "bold") {
869 if (style2 == "r") {
871 } else if (style2 == "i") {
873 } else if (style2 == "o") {
875 }
876 }
877 n1++;
878 n2 = name.Index("-", n1);
879 n1 = n2 + 1;
880 n2 = name.Index("-", n1);
881 n1 = n2 + 1;
882 n2 = name.Index("-", n1);
883 if (n2 != kNPOS) {
884 n1 = n2 + 1;
885 n2 = name.Index("-", n1);
886 sz = name(n1, n2 - n1);
887
889 if (le) {
890 fFontSizes->Select(le->EntryId());
891 }
892 }
893}
894
895////////////////////////////////////////////////////////////////////////////////
896/// Set color
897
899{
900 if (fSample) {
901 fTextColor = color;
903 }
906 fInitColor = color;
907}
908
909////////////////////////////////////////////////////////////////////////////////
910/// Set align
911
913{
914 if (fSample) {
915 fTextAlign = align;
917 }
918
919 for (int i = 0; gAlignValues[i] != 0; ++i) {
920 if (gAlignValues[i] == align) {
922 }
923 }
924 fInitAlign = align;
926}
927
928////////////////////////////////////////////////////////////////////////////////
929/// Enable/disable align combobox
930
932{
934}
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
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:75
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Ssiz_t kNPOS
Definition RtypesCore.h:117
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassImp(name)
Definition Rtypes.h:382
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:185
Int_t gErrorIgnoreLevel
Error handling routines.
Definition TError.cxx:31
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:737
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get graphics context from the gc pool.
Definition TGClient.cxx:320
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition TGClient.cxx:348
void FreeGC(const TGGC *gc)
Free a graphics context.
Definition TGClient.cxx:328
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:372
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:287
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:316
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
UInt_t GetDefaultWidth() const override
Definition TGFrame.h:312
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
UInt_t GetDefaultHeight() const override
Definition TGFrame.h:314
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1072
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1022
Font selection dialog, allowing to select one in the list of available fonts in the system.
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:722
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:190
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:191
void MapWindow() override
map window
Definition TGFrame.h:204
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
UInt_t GetHeight() const
Definition TGFrame.h:225
UInt_t GetWidth() const
Definition TGFrame.h:224
A composite frame with a border and a title.
Definition TGFrame.h:522
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
Basic listbox entries.
Definition TGListBox.h:24
Int_t EntryId() const
Definition TGListBox.h:40
This class handles GUI labels.
Definition TGLabel.h:24
void SetTextJustify(Int_t tmode)
Set text justification.
Definition TGLabel.cxx:396
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition TGLabel.cxx:362
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
Definition TGLabel.cxx:324
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:1858
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1801
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition TGFrame.cxx:1893
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
virtual void SetPosition(Int_t pos)=0
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:498
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition TGFrame.cxx:1957
A composite frame that layout their children in vertical way.
Definition TGFrame.h:374
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:47
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:869
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:417
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition TString.cxx:1163
const char * Data() const
Definition TString.h:376
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Definition TString.cxx:1830
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:623
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:2378
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:651
Graphics context structure.
Definition GuiTypes.h:224
Mask_t fMask
bit mask specifying which fields are valid
Definition GuiTypes.h:251
ULong_t fForeground
foreground pixel
Definition GuiTypes.h:227
FontH_t fFont
default text font for text operations
Definition GuiTypes.h:242
TString fName
font name
Bool_t fBold
bold flag
Pixel_t fColor
text color
Bool_t fItalic
italic flag
UInt_t fAlign
text alignment