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/*
84static const char *gFontList[] = {
85 "Arial",
86 "Comic Sans MS",
87 "Courier New",
88 "Georgia",
89 "Impact",
90 "Monotype",
91 "Symbol",
92 "Times New Roman",
93 "Trebuchet MS",
94 "Verdana",
95 "Webdings",
96 "Wingdings",
97 0,
98};
99
100static const char *gFontList2[] = {
101 "FreeSans",
102 "FreeSerif",
103 "FreeMono",
104 "OpenSymbol",
105 0
106};
107*/
108
109//_____________________________________________________________________________
110//
111// TGFontDialog
112//
113// Font selection dialog, allowing to select one in the list of available fonts
114// in the system.
115//_____________________________________________________________________________
116
118
119////////////////////////////////////////////////////////////////////////////////
120/// Create font dialog. When closed via OK button fontProp is set to
121/// the newly selected font. If closed via Cancel button or WM close box
122/// fontProp->fName == "".
123
125 FontProp_t *fontProp, const TString &sample,
126 char **fontList, Bool_t wait) :
127 TGTransientFrame(p, t, 100, 100), fFontNames(0), fFontSizes(0), fFontStyles(0),
128 fTextAligns(0), fColorSelect(0), fFontProp(0), fItalic(0), fBold(0), fSize(0),
129 fTextAlign(0), fTextColor(0), fNumberOfFonts(0)
130{
131 TGLabel *lbl;
132 TGHorizontalFrame *hf, *hf2;
133 TGVerticalFrame *vf;
134 Int_t i, w;
135 UInt_t width = 0, height = 0;
136
137 fSampleTextGC = 0;
138 fLabelFont = 0;
139 fSample = 0;
140 fHitOK = kFALSE;
141 fWaitFor = wait;
142 fInitFont = 0;
143 fInitColor = 0;
144 fInitAlign = 0;
145
146 if (!fontProp) {
147 Error("TGFontDialog", "fontProp argument may not be 0");
148 return;
149 }
151
153 TGLayoutHints *lh2 = new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 0, 2, 2);
154
155 fFontProp = fontProp;
156 if (fontProp->fName == "") {
157 fName = fontList ? fontList[0] : "Arial";
158 fItalic = kFALSE;
159 fBold = kFALSE;
160 fSize = 12;
161 fTextAlign = gAlignValues[6]; //kTextBottom | kTextLeft
163 } else {
164 fName = fontProp->fName;
165 fItalic = fontProp->fItalic;
166 fBold = fontProp->fBold;
167 fSize = fontProp->fSize;
168 fTextAlign = fontProp->fAlign;
169 fTextColor = fontProp->fColor;
170 }
171
172 hf = new TGHorizontalFrame(this, 10, 10);
173 AddFrame(hf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5));
174
175 //--------------------- font names listbox
176
177 vf = new TGVerticalFrame(hf, 10, 10);
178
179 lbl = new TGLabel(vf, new TGString("Font:"));
180 vf->AddFrame(lbl, lh2);
181
184
185 if (gVirtualX->InheritsFrom("TGX11") || gVirtualX->InheritsFrom("TGCocoa")) {
186 fFontNames->Connect("Selected(char*)", "TGFontDialog", this, "UpdateStyleSize(char*)");
187 }
188
189 fFontNames->Associate(this);
191
193 0, 10, 2, 2));
194
195 //--------------------- font styles listbox
196
197 vf = new TGVerticalFrame(hf, 10, 10);
198
199 lbl = new TGLabel(vf, new TGString("Style:"));
200 vf->AddFrame(lbl, lh2);
201
204 fFontStyles->Associate(this);
205 vf->AddFrame(fFontStyles, lh1);
206
208 0, 10, 2, 2));
209
210 //--------------------- font sizes listbox
211
212 vf = new TGVerticalFrame(hf, 10, 10);
213
214 lbl = new TGLabel(vf, new TGString("Size:"));
215 vf->AddFrame(lbl, lh2);
216
219 fFontSizes->Associate(this);
220 vf->AddFrame(fFontSizes, lh1);
221
223 0, 0, 2, 2));
224
225 //--------------------- Text align and color
226
227 vf = new TGVerticalFrame(hf, 10, 10);
228
229 lbl = new TGLabel(vf, new TGString("Text Align :"));
230 vf->AddFrame(lbl, new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
231
233 fTextAligns->Associate(this);
235 kLHintsExpandX, 5, 5, 0, 5));
236
237 fTextAligns->Resize(110, 20);
238
239 vf->Layout();
240 vf->Resize(vf->GetDefaultSize());
241
242 w = hf->GetDefaultWidth();
243
244 hf2 = new TGHorizontalFrame(vf, 10, 10);
245 vf->AddFrame(hf2, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 5));
246
247 lbl = new TGLabel(hf2, new TGString("Text Color"));
248 hf2->AddFrame(lbl, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 20, 5));
249
251 fColorSelect->Associate(this);
252
254
255 vf->Resize(vf->GetDefaultSize());
256
258 10, 0, lbl->GetDefaultHeight()+6, 0));
259
260 //--------------------- initialize controls
261
263
264 Int_t cnt = 0;
265 Bool_t own = kFALSE;
266
267 if (!fontList) {
268 fontList = gVirtualX->ListFonts("-*-*-*-*", 10000, cnt);
269 own = kTRUE;
270 }
271
272 Build(fontList, cnt);
273
274 for (i = 0; gAlignTypes[i] != 0; ++i) {
276 }
277
278 for (i = 0; gAlignValues[i] != 0; ++i) {
279 if (gAlignValues[i] == fTextAlign) {
281 }
282 }
283
284 TGLBEntry *entry = fTextAligns->FindEntry("bottom center");
285 if (entry)
286 fTextAligns->Resize(entry->GetWidth() + 20, entry->GetHeight() > 20 ?
287 entry->GetHeight() : 20);
288
289 vf->Layout();
290 vf->Resize(vf->GetDefaultSize());
291
292 //--------------------- sample box
293
294 hf = new TGHorizontalFrame(this, 10, 10);
295 AddFrame(hf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 5, 5, 5, 5));
296
297 TGGroupFrame *gf = new TGGroupFrame(hf, new TGString("Sample"));
298 hf->AddFrame(gf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 3, 3, 3, 3));
299
300 TGCompositeFrame *cf = new TGCompositeFrame(gf, 200, 100, kSunkenFrame);
303 1, 1, 3, 1));
304
305 if (sample == "")
307 else
308 fSampleText = sample;
309
310 for (i = 0; gFontSizes[i] != 0; ++i) {
311 if (fSize == atoi(gFontSizes[i])) {
312 fFontSizes->Select(i);
313 break;
314 }
315 }
316
317 if ((fBold == kFALSE) && (fItalic == kFALSE))
319 if ((fBold == kTRUE) && (fItalic == kFALSE))
321 if ((fBold == kFALSE) && (fItalic == kTRUE))
323 if ((fBold == kTRUE) && (fItalic == kTRUE))
325
326 GetFontName(); //sets fLName and other data members
327
328 GCValues_t gcval;
329 gcval.fMask = kGCForeground | kGCFont;
330 gcval.fForeground = fTextColor;
331 gcval.fFont = fLabelFont->GetFontHandle();
332 fSampleTextGC = fClient->GetGC(&gcval, kTRUE);
333 fSample = new TGLabel(cf, fSampleText); //, (*fSampleTextGC)(), (*fLabelFont)());
337 1, 1, 1, 1));
338 cf->Layout();
339 if (own) gVirtualX->FreeFontNames(fontList);
340
341 gf->Resize(w, 80);
342
343 //--------------------- OK and Cancel buttons
344
345 vf = new TGVerticalFrame(hf, 10, 10, kFixedWidth);
346
347 TGTextButton *ok = new TGTextButton(vf, new TGHotString("&OK"), kFDLG_OK);
348 ok->Associate(this);
349 vf->AddFrame(ok, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 20, 5));
350
351 TGTextButton *cancel = new TGTextButton(vf, new TGHotString("&Cancel"), kFDLG_CANCEL);
352 cancel->Associate(this);
353 vf->AddFrame(cancel, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
354
355 vf->Resize(cancel->GetDefaultWidth()+70, vf->GetDefaultHeight());
356
357 hf->AddFrame(vf, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
359
363
368
369 SetWindowName("Font Selection");
370 SetIconName("Font Selection");
371 SetClassHints("ROOT", "FontDialog");
372
378
379 //---- set minimum size to the dialog box
381 height = GetDefaultHeight();
383 Resize(width, height);
384
385 //---- position the dialog relative to the parent's window
387
388 // set minimum size
389 SetWMSize(width, height);
390 SetWMSizeHints(width, height, 10000, 10000, 0, 0);
391
392 if (fWaitFor) {
393 MapWindow();
394 fClient->WaitForUnmap(this);
395 DeleteWindow();
396 }
397}
398
399////////////////////////////////////////////////////////////////////////////////
400/// Delete all widgets.
401
403{
404 //fClient->FreeFont(fLabelFont);
406}
407
408////////////////////////////////////////////////////////////////////////////////
409/// Called when window is closed via window manager.
410
412{
413 if (fWaitFor) {
414 UnmapWindow();
415 return;
416 }
417
418 if (!fHitOK) {
419 fFontProp->fName = "";
420
421 if (fInitFont) {
423 FontSelected((char*)fInitFont->GetName());
424 }
425 if (fInitColor) {
428 }
429
430 if (fInitAlign) {
433 }
434 }
435 fFontNames->Select(0);
437 fFontSizes->Select(0);
438
439 // don't call DeleteWindow() here since that will cause access
440 // to the deleted dialog in the WaitFor() method (see ctor)
441 UnmapWindow();
442}
443
444////////////////////////////////////////////////////////////////////////////////
445/// Handle dialog events.
446
448{
449 switch (GET_MSG(msg)) {
450 case kC_COMMAND:
451 switch (GET_SUBMSG(msg)) {
452 case kCM_BUTTON:
453 switch (parm1) {
454
455 case kFDLG_OK:
456 fHitOK = kTRUE;
463 CloseWindow();
464 break;
465 case kFDLG_CANCEL:
466 fHitOK = kFALSE;
467 CloseWindow();
468 break;
469 }
470 break;
471
472 case kCM_LISTBOX:
473 GetFontName();
474 break;
475
476 case kCM_COMBOBOX:
477 GetFontName();
478 break;
479
480 default:
481 break;
482 }
483 break;
484
485 case kC_COLORSEL:
486 switch (GET_SUBMSG(msg)) {
487
488 case kCOL_SELCHANGED:
489 {
490 if (parm2 != (Int_t)fTextColor) {
491 fTextColor = parm2;
492 GetFontName();
493 }
494 }
495 break;
496
497 default:
498 break;
499 }
500 break;
501
502 default:
503 break;
504 }
505 return kTRUE;
506}
507
508////////////////////////////////////////////////////////////////////////////////
509/// Build font dialog.
510
511Bool_t TGFontDialog::Build(char **fontList, Int_t cnt)
512{
513 TString family;
514 TString font;
515
516 Int_t i;
517 fNumberOfFonts = 1;
518 Int_t n1, n2;
519
520 for (i = 0; i < cnt; i++) {
521 font = fontList[i];
522 n1 = font.Index("-", 1);
523 n2 = font.Index("-", n1+1);
524 family = font(n1+1, n2-n1-1);
525
526 if ((family.Length() == 0) || (family.BeginsWith("@"))) {
527 continue;
528 }
529
530 if (!fFontNames->FindEntry(family.Data())) {
532 }
533 }
534
536
538
539 if (le) {
540 fFontNames->Select(le->EntryId());
541 }
542
544
545 return kTRUE;
546}
547
548////////////////////////////////////////////////////////////////////////////////
549/// Build font style and size list boxes
550
551void TGFontDialog::UpdateStyleSize(const char *family)
552{
553 if (!family) {
554 return;
555 }
556
557 TString font = family;
558 Bool_t styles[4] = { kFALSE, kFALSE, kFALSE, kFALSE };
559 Int_t cnt = 0;
560 Int_t i = 0;
561
562 TString fname;
563 char **fontList = 0;
564
565 fname = TString::Format("-*-%s-*-*", family);
566 fontList = gVirtualX->ListFonts(fname.Data(), 1000, cnt);
567
568 fFontSizes->RemoveEntries(0, 1000);
570
571 fFontStyles->RemoveEntries(0, 100);
573
574 if (!cnt || !fontList) {
575 return;
576 }
577
578 TString style1;
579 TString style2;
580 TString sz;
582 Int_t n1, n2;
583 Bool_t x11 = gVirtualX->InheritsFrom("TGX11");
584 Bool_t all_sizes = !x11;
585 Bool_t all_styles = !x11;
586
587 //
588 if (gVirtualX->InheritsFrom("TGCocoa")) {
589 all_sizes = kTRUE;
590 all_styles = kFALSE;
591 }
592
593 int szn = 0;
594
595 fFontSizes->AddEntry("12", szn++);
596
597 for (i = 0; i < cnt; i++) {
598 name = fontList[i];
599 n1 = name.Index(family);
600
601 if (n1 == kNPOS) {
602 break;
603 }
604 n1 += font.Length() + 1;
605 n2 = name.Index("-", n1);
606 if (n2 == kNPOS) {
607 break;
608 }
609
610 style1 = name(n1, n2 - n1);
611
612 n1 = n2 + 1;
613 n2 = name.Index("-", n1);
614 if (n2 == kNPOS) {
615 break;
616 }
617 style2 = name(n1, n2 - n1);
618
619 if ((style1 == "normal") || (style1 == "medium")) {
620 if (style2 == "r") {
621 styles[0] = kTRUE;
622 gFontStylesReal[0] = style1 + "-" + style2;
623 } else if (style2 == "i") {
624 styles[2] = kTRUE;
625 gFontStylesReal[2] = style1 + "-" + style2;
626 } else if (style2 == "o") {
627 styles[2] = kTRUE;
628 gFontStylesReal[2] = style1 + "-" + style2;
629 }
630 } else if (style1 == "bold") {
631 if (style2 == "r") {
632 styles[1] = kTRUE;
633 gFontStylesReal[1] = style1 + "-" + style2;
634 } else if (style2 == "i") {
635 styles[3] = kTRUE;
636 gFontStylesReal[3] = style1 + "-" + style2;
637 } else if (style2 == "o") {
638 styles[3] = kTRUE;
639 gFontStylesReal[3] = style1 + "-" + style2;
640 }
641 } else if (style1 == "(null)") {
642 styles[0] = kTRUE;
643 gFontStylesReal[0] = "normal-r";
644 styles[1] = kTRUE;
645 gFontStylesReal[1] = "bold-r";
646 styles[2] = kTRUE;
647 gFontStylesReal[2] = "normal-i";
648 styles[3] = kTRUE;
649 gFontStylesReal[3] = "bold-i";
650 }
651
652 n1++;
653 n2 = name.Index("-", n1);
654 n1 = n2 + 1;
655 n2 = name.Index("-", n1);
656 n1 = n2 + 1;
657
658 if (n2 != kNPOS) {
659 n1 = n2 + 2;
660 n2 = name.Index("-", n1);
661 sz = name(n1, n2 - n1);
662 if (!sz.IsDigit()) {
663 continue;
664 }
665
666 all_sizes = (sz == "0") && !x11;
667 if (!all_sizes) {
668 sz.Strip();
669 if (sz.Length() == 1) {
670 sz = " " + sz;
671 }
672 if (!fFontSizes->FindEntry(sz.Data())) {
673 fFontSizes->AddEntry(sz.Data(), szn++);
674 }
675 }
676 }
677 }
678 gVirtualX->FreeFontNames(fontList);
679
680 Bool_t nostyles = kTRUE;
681 for (i = 0; gFontStyles[i] != 0; ++i) {
682 if (all_styles || styles[i]) {
683 nostyles = kFALSE;
685 }
686 }
687
688 if (nostyles && x11) {
690 fBold = kFALSE;
691 fItalic = kFALSE;
692 }
693
694 if (!fBold) {
695 if (!fItalic) {
697 } else {
699 }
700 } else {
701 if (!fItalic) {
703 } else {
705 }
706 }
707
708// if (nostyles) {
709// fFontNames->RemoveEntry(fFontNames->FindEntry(family)->EntryId());
710// }
711
714//
715
716 sz = TString::Format("%d", fSize);
717 if (sz.Length() == 1) {
718 sz = " " + sz;
719 }
720
721 for (i = 0; gFontSizes[i] != 0; ++i) {
722 if (all_sizes && !fFontSizes->FindEntry(gFontSizes[i])) {
724 }
725 if (sz == gFontSizes[i]) {
726 fFontSizes->Select(i);
727 }
728 }
729
733}
734
735////////////////////////////////////////////////////////////////////////////////
736/// Sets fLName and other data members.
737
739{
741 const char *size, *name;
742 Int_t sel;
745
746 TString oldName = fName;
748
749 if (!e) {
750 fFontNames->Select(1);
752 }
753 name = e ? e->GetText()->GetString() : "";
754 fName = name;
755
757 size = e ? e->GetText()->GetString() : "0";
758 fSize = atoi(size);
759
760 sel = fFontStyles->GetSelected();
761 if (sel < 0) sel = 0;
762
763 switch(sel) {
764 case 0:
765 fItalic = kFALSE;
766 fBold = kFALSE;
767 break;
768 case 1:
769 fItalic = kFALSE;
770 fBold = kTRUE;
771 break;
772 case 2:
773 fItalic = kTRUE;
774 fBold = kFALSE;
775 break;
776 case 3:
777 fItalic = kTRUE;
778 fBold = kTRUE;
779 break;
780 default:
781 fItalic = kFALSE;
782 fBold = kFALSE;
783 break;
784 }
785
786 const char *rgstry = "*";
787
788 if ((fName == "Symbol") || (fName == "Webdings") || (fName == "Wingdings")) {
789 rgstry = "microsoft";
790 }
791
792 TString oldFont = fLName;
793 fLName = TString::Format("-*-%s-%s-*-*-%s-*-*-*-*-*-%s-*", name,
794 gFontStylesReal[sel].Data(), size, rgstry);
795
796 if (oldFont != fLName) {
797 if (fLabelFont) {
798 //fClient->FreeFont(fLabelFont);
800
801 if (!fLabelFont) {
802 fLabelFont = fClient->GetFont("fixed");
803 }
804 } else {
805 fLabelFont = fClient->GetFont("fixed");
806 }
807
808 if (!fLabelFont) {
809 // should not happen
810 fLName = oldFont;
811 }
812 else if (fSample) {
814 }
815 }
816
817 Int_t oldAlign = fTextAlign;
818
820 fTextAlign = gAlignValues[idx >= 0 ? idx : 6];
821
822 if (fSample) {
823 if (fTextAlign != oldAlign) {
826 }
830 }
831 FontSelected((char*)fLName.Data());
832 fClient->NeedRedraw(this);
833 gErrorIgnoreLevel = sav;
834}
835
836////////////////////////////////////////////////////////////////////////////////
837/// Set font
838
840{
841 if (!font) {
842 return;
843 }
844 TString name = font->GetName();
845
846 if (name.Index("-", 1) == kNPOS) {
847 return;
848 }
849
850 if (fSample) {
851 fLabelFont = font;
853 }
854 fInitFont = font;
855
856 TString style1;
857 TString style2;
858 TString sz;
859
860 TString family;
861 Int_t n1, n2;
862
863 n1 = name.Index("-", 1);
864 n2 = name.Index("-", n1 + 1);
865 n1++;
866 family = name(n1, n2 - n1);
867
869
870 if (le) {
871 fFontNames->Select(le->EntryId());
872 }
873
874 n1 = n2 + 1;
875 n2 = name.Index("-", n1);
876
877 style1 = name(n1, n2 - n1);
878
879 n1 = n2 + 1;
880 n2 = name.Index("-", n1);
881 if (n2 == kNPOS) {
882 return;
883 }
884 style2 = name(n1, n2 - n1);
885
886 if ((style1 == "normal") || (style1 == "medium")) {
887 if (style2 == "r") {
889 } else if (style2 == "i") {
891 } else if (style2 == "o") {
893 }
894 } else if (style1 == "bold") {
895 if (style2 == "r") {
897 } else if (style2 == "i") {
899 } else if (style2 == "o") {
901 }
902 }
903 n1++;
904 n2 = name.Index("-", n1);
905 n1 = n2 + 1;
906 n2 = name.Index("-", n1);
907 n1 = n2 + 1;
908 n2 = name.Index("-", n1);
909 n1 = n2 + 1;
910 if (n2 != kNPOS) {
911 n1 = n2 + 1;
912 n2 = name.Index("-", n1);
913 sz = name(n1, n2 - n1);
914
916 if (le) {
917 fFontSizes->Select(le->EntryId());
918 }
919 }
920}
921
922////////////////////////////////////////////////////////////////////////////////
923/// Set color
924
926{
927 if (fSample) {
928 fTextColor = color;
930 }
933 fInitColor = color;
934}
935
936////////////////////////////////////////////////////////////////////////////////
937/// Set align
938
940{
941 if (fSample) {
942 fTextAlign = align;
944 }
945
946 for (int i = 0; gAlignValues[i] != 0; ++i) {
947 if (gAlignValues[i] == align) {
949 }
950 }
951 fInitAlign = align;
953}
954
955////////////////////////////////////////////////////////////////////////////////
956/// Enable/disable align combobox
957
959{
961}
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
const Ssiz_t kNPOS
Definition RtypesCore.h:115
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:92
long Long_t
Definition RtypesCore.h:54
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassImp(name)
Definition Rtypes.h:364
include TDocParser_001 C image html pict1_TDocParser_001 png width
const Int_t kFatal
Definition TError.h:51
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:187
R__EXTERN Int_t gErrorIgnoreLevel
Definition TError.h:129
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:73
@ kMWMFuncAll
Definition TGFrame.h:57
@ kMWMFuncResize
Definition TGFrame.h:58
@ kMWMDecorMaximize
Definition TGFrame.h:77
@ kMWMDecorMinimize
Definition TGFrame.h:76
@ kMWMDecorMenu
Definition TGFrame.h:75
@ kMWMDecorAll
Definition TGFrame.h:71
@ kMWMFuncMaximize
Definition TGFrame.h:61
@ kMWMInputModeless
Definition TGFrame.h:65
@ kMWMFuncMinimize
Definition TGFrame.h:60
@ kDeepCleanup
Definition TGFrame.h:50
@ kLHintsRight
Definition TGLayout.h:33
@ kLHintsExpandY
Definition TGLayout.h:38
@ kLHintsLeft
Definition TGLayout.h:31
@ kLHintsCenterY
Definition TGLayout.h:35
@ kLHintsNormal
Definition TGLayout.h:39
@ kLHintsCenterX
Definition TGLayout.h:32
@ kLHintsTop
Definition TGLayout.h:34
@ kLHintsExpandX
Definition TGLayout.h:37
@ kTextCenterX
Definition TGWidget.h:35
@ kTextLeft
Definition TGWidget.h:33
@ kTextBottom
Definition TGWidget.h:37
@ kTextTop
Definition TGWidget.h:36
@ kTextRight
Definition TGWidget.h:34
@ kTextCenterY
Definition TGWidget.h:38
char name[80]
Definition TGX11.cxx:110
#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:736
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get graphics context from the gc pool.
Definition TGClient.cxx:319
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition TGClient.cxx:347
void FreeGC(const TGGC *gc)
Free a graphics context.
Definition TGClient.cxx:327
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:371
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual Int_t GetSelected() const
Definition TGComboBox.h:134
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:106
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.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1102
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:348
virtual void Layout()
Layout the elements of the composite frame.
Definition TGFrame.cxx:1242
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1057
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:352
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1149
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:350
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1007
TGGC * fSampleTextGC
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle dialog events.
Pixel_t fTextColor
virtual void AlignSelected(Int_t a)
Bool_t Build(char **fontList, Int_t cnt)
Build font dialog.
virtual void SetAlign(Int_t align)
Set align.
TGListBox * fFontSizes
TString fSampleText
TGLabel * fSample
TGFont * fLabelFont
TGListBox * fFontStyles
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
Pixel_t fInitColor
FontProp_t * fFontProp
virtual void FontSelected(char *font)
TString fName
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.
virtual void EnableAlign(Bool_t on=kTRUE)
Enable/disable align combobox.
void GetFontName()
Sets fLName and other data members.
TGFont * fInitFont
TGColorSelect * fColorSelect
virtual void SetColor(Pixel_t color)
Set color.
Int_t fNumberOfFonts
TGListBox * fFontNames
TGComboBox * fTextAligns
virtual void ColorSelected(Pixel_t c)
TString fLName
FontH_t GetFontHandle() const
Definition TGFont.h:192
static Pixel_t GetBlackPixel()
Get black pixel value.
Definition TGFrame.cxx:707
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:214
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:215
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:261
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:590
UInt_t GetHeight() const
Definition TGFrame.h:249
virtual void MapWindow()
map window
Definition TGFrame.h:228
UInt_t GetWidth() const
Definition TGFrame.h:248
virtual void UnmapWindow()
unmap window
Definition TGFrame.h:230
Int_t EntryId() const
Definition TGListBox.h:67
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
virtual void SortByName(Bool_t ascend=kTRUE)
Sort entries by name.
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
virtual TGLBEntry * Select(Int_t id, Bool_t sel=kTRUE)
Definition TGListBox.h:351
virtual TGLBEntry * GetSelectedEntry() const
Definition TGListBox.h:355
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.
virtual TGScrollBar * GetScrollBar() const
Definition TGListBox.h:336
virtual void Layout()
Layout the listbox components.
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:1817
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1762
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition TGFrame.cxx:1852
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition TGFrame.cxx:1827
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:1865
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1749
TGClient * fClient
Definition TGObject.h:37
virtual void SetPosition(Int_t pos)=0
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition TGFrame.cxx:1916
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:82
@ kEditDisable
Definition TGWindow.h:58
virtual const char * GetName() const
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:866
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:1126
const char * Data() const
Definition TString.h:369
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Definition TString.cxx:1783
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:615
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:2331
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:639
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