Logo ROOT  
Reference Guide
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
356 height = GetDefaultHeight();
358 Resize(width, height);
359
360 //---- position the dialog relative to the parent's window
362
363 // set minimum size
364 SetWMSize(width, height);
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
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
734 sel = fFontStyles->GetSelected();
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}
int Int_t
Definition: CPyCppyy.h:43
unsigned int UInt_t
Definition: CPyCppyy.h:44
long Long_t
Definition: CPyCppyy.h:50
size_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
const Ssiz_t kNPOS
Definition: RtypesCore.h:124
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassImp(name)
Definition: Rtypes.h:364
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
const Int_t kFatal
Definition: TError.h:49
R__EXTERN Int_t gErrorIgnoreLevel
Definition: TError.h:127
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
#define gVirtualX
Definition: TVirtualX.h:338
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:739
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get graphics context from the gc pool.
Definition: TGClient.cxx:322
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition: TGClient.cxx:350
void FreeGC(const TGGC *gc)
Free a graphics context.
Definition: TGClient.cxx:330
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:374
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...
Definition: TGComboBox.cxx:456
virtual void SetEnabled(Bool_t on=kTRUE)
Set state of combo box. If kTRUE=enabled, kFALSE=disabled.
Definition: TGComboBox.cxx:646
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
Definition: TGComboBox.cxx:427
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
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 Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1257
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1072
TGCompositeFrame(const TGCompositeFrame &)=delete
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:316
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
Font selection dialog, allowing to select one in the list of available fonts in the system.
Definition: TGFontDialog.h:28
TGGC * fSampleTextGC
GC used for sample text.
Definition: TGFontDialog.h:59
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle dialog events.
Pixel_t fTextColor
text color
Definition: TGFontDialog.h:54
virtual void AlignSelected(Int_t a)
Definition: TGFontDialog.h:84
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
Definition: TGFontDialog.h:42
Int_t fTextAlign
text alignment
Definition: TGFontDialog.h:53
Int_t fSize
font size
Definition: TGFontDialog.h:52
Bool_t fBold
bold flag
Definition: TGFontDialog.h:51
TString fSampleText
string used for sample
Definition: TGFontDialog.h:58
Bool_t fHitOK
flag = kTRUE if user press the Ok button
Definition: TGFontDialog.h:61
TGLabel * fSample
sample of selected font
Definition: TGFontDialog.h:45
TGFont * fLabelFont
TGFont used for sample text.
Definition: TGFontDialog.h:60
TGListBox * fFontStyles
list of font styles
Definition: TGFontDialog.h:43
TGFontDialog(const TGWindow *parent=0, const TGWindow *t=0, FontProp_t *fontProp=0, const TString &sample="", char **fontList=0, Bool_t wait=kTRUE)
Create font dialog.
Bool_t fWaitFor
if kTRUE WaitForUnmap is called in constructor.
Definition: TGFontDialog.h:63
Pixel_t fInitColor
initial value of text color
Definition: TGFontDialog.h:55
FontProp_t * fFontProp
font info structure
Definition: TGFontDialog.h:49
virtual void FontSelected(char *font)
Definition: TGFontDialog.h:82
TString fName
font name
Definition: TGFontDialog.h:47
virtual void UpdateStyleSize(const char *family)
Build font style and size list boxes.
virtual void SetFont(TGFont *font)
Set font.
virtual ~TGFontDialog()
Delete all widgets.
virtual void CloseWindow()
Called when window is closed via window manager.
Bool_t fItalic
italic flag
Definition: TGFontDialog.h:50
virtual void EnableAlign(Bool_t on=kTRUE)
Enable/disable align combobox.
void GetFontName()
Sets fLName and other data members.
TGFont * fInitFont
initial font
Definition: TGFontDialog.h:57
TGColorSelect * fColorSelect
color selection dialog
Definition: TGFontDialog.h:46
Int_t fInitAlign
initial value of text align
Definition: TGFontDialog.h:56
virtual void SetColor(Pixel_t color)
Set color.
Int_t fNumberOfFonts
total number of fonts
Definition: TGFontDialog.h:62
TGListBox * fFontNames
list of font names
Definition: TGFontDialog.h:41
TGComboBox * fTextAligns
font alignment selection
Definition: TGFontDialog.h:44
virtual void ColorSelected(Pixel_t c)
Definition: TGFontDialog.h:86
TString fLName
logical font name
Definition: TGFontDialog.h:48
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
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:190
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:191
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:276
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:605
UInt_t GetHeight() const
Definition: TGFrame.h:225
virtual void MapWindow()
map window
Definition: TGFrame.h:204
UInt_t GetWidth() const
Definition: TGFrame.h:224
virtual void UnmapWindow()
unmap window
Definition: TGFrame.h:206
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:386
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.
Definition: TGListBox.cxx:1505
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1411
virtual TGLBEntry * Select(Int_t id, Bool_t sel=kTRUE)
Definition: TGListBox.h:284
virtual TGScrollBar * GetScrollBar() const
Definition: TGListBox.h:269
virtual TGLBEntry * GetSelectedEntry() const
Definition: TGListBox.h:288
virtual Int_t GetSelected() const
Return id of selected listbox item.
Definition: TGListBox.cxx:1515
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
Definition: TGListBox.cxx:1203
virtual void Layout()
Layout the listbox components.
Definition: TGListBox.cxx:1452
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
Remove a range of entries defined by from_ID and to_ID.
Definition: TGListBox.cxx:1353
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
Definition: TGListBox.cxx:1635
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition: TGFrame.cxx:1838
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition: TGFrame.cxx:1783
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition: TGFrame.cxx:1873
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition: TGFrame.cxx:1848
void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
Definition: TGFrame.cxx:1886
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1770
TGClient * fClient
Connection to display server.
Definition: TGObject.h:27
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:1937
A composite frame that layout their children in vertical way.
Definition: TGFrame.h:375
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:50
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
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:136
Ssiz_t Length() const
Definition: TString.h:410
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition: TString.cxx:1131
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Definition: TString.cxx:1788
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:615
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
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:639
static const std::string name("name")
const char * cnt
Definition: TXMLSetup.cxx:75
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
Definition: TGFontDialog.h:32
Bool_t fBold
bold flag
Definition: TGFontDialog.h:36
Int_t fSize
font size
Definition: TGFontDialog.h:33
Pixel_t fColor
text color
Definition: TGFontDialog.h:35
Bool_t fItalic
italic flag
Definition: TGFontDialog.h:37
UInt_t fAlign
text alignment
Definition: TGFontDialog.h:34