51 "8",
"9",
"10",
"11",
"12",
"13",
"14",
"16",
52 "18",
"20",
"22",
"24",
"26",
"28",
"30",
"32",
53 "34",
"36",
"48",
"72", 0
57 "Normal",
"Bold",
"Italic",
"Bold Italic", 0
64 "top left",
"top center",
"top right",
65 "middle left",
"middle center",
"middle right",
66 "bottom left",
"bottom center",
"bottom right",
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)
135 UInt_t width = 0, height = 0;
147 Error(
"TGFontDialog",
"fontProp argument may not be 0");
155 fFontProp = fontProp;
156 if (fontProp->fName ==
"") {
157 fName = fontList ? fontList[0] :
"Arial";
164 fName = fontProp->fName;
165 fItalic = fontProp->fItalic;
166 fBold = fontProp->fBold;
167 fSize = fontProp->fSize;
168 fTextAlign = fontProp->fAlign;
169 fTextColor = fontProp->fColor;
183 fFontNames->Resize(120, fFontNames->GetDefaultHeight());
186 fFontNames->Connect(
"Selected(char*)",
"TGFontDialog",
this,
"UpdateStyleSize(char*)");
189 fFontNames->Associate(
this);
203 fFontStyles->Resize(80, fFontStyles->GetDefaultHeight());
204 fFontStyles->Associate(
this);
218 fFontSizes->Resize(50, fFontSizes->GetDefaultHeight());
219 fFontSizes->Associate(
this);
233 fTextAligns->Associate(
this);
237 fTextAligns->Resize(110, 20);
251 fColorSelect->Associate(
this);
262 Resize(GetDefaultSize());
268 fontList =
gVirtualX->ListFonts(
"-*-*-*-*", 10000, cnt);
272 Build(fontList, cnt);
280 fTextAligns->Select(i);
308 fSampleText = sample;
312 fFontSizes->Select(i);
318 fFontStyles->Select(0);
320 fFontStyles->Select(1);
322 fFontStyles->Select(2);
324 fFontStyles->Select(3);
331 gcval.
fFont = fLabelFont->GetFontHandle();
332 fSampleTextGC = fClient->GetGC(&gcval,
kTRUE);
333 fSample =
new TGLabel(cf, fSampleText);
334 fSample->SetTextJustify(
gAlignValues[fTextAligns->GetSelected()]);
339 if (own)
gVirtualX->FreeFontNames(fontList);
358 SetEditDisabled(kEditDisable);
360 fInitAlign = fTextAlign;
361 fInitColor = fTextColor;
362 fInitFont = fLabelFont;
364 fFontNames->GetScrollBar()->SetPosition(fFontNames->GetSelected()-3);
365 fFontSizes->GetScrollBar()->SetPosition(fFontSizes->GetSelected()-3);
366 fFontSizes->Layout();
367 fFontNames->Layout();
369 SetWindowName(
"Font Selection");
370 SetIconName(
"Font Selection");
371 SetClassHints(
"ROOT",
"FontDialog");
380 width = GetDefaultWidth();
381 height = GetDefaultHeight();
383 Resize(width, height);
389 SetWMSize(width, height);
390 SetWMSizeHints(width, height, 10000, 10000, 0, 0);
394 fClient->WaitForUnmap(
this);
520 for (i = 0; i <
cnt; i++) {
522 n1 = font.
Index(
"-", 1);
523 n2 = font.
Index(
"-", n1+1);
524 family = font(n1+1, n2-n1-1);
574 if (!cnt || !fontList) {
588 if (
gVirtualX->InheritsFrom(
"TGCocoa")) {
597 for (i = 0; i <
cnt; i++) {
599 n1 = name.
Index(family);
605 n2 = name.
Index(
"-", n1);
610 style1 =
name(n1, n2 - n1);
613 n2 = name.
Index(
"-", n1);
617 style2 =
name(n1, n2 - n1);
619 if ((style1 ==
"normal") || (style1 ==
"medium")) {
622 gFontStylesReal[0] = style1 +
"-" + style2;
623 }
else if (style2 ==
"i") {
625 gFontStylesReal[2] = style1 +
"-" + style2;
626 }
else if (style2 ==
"o") {
628 gFontStylesReal[2] = style1 +
"-" + style2;
630 }
else if (style1 ==
"bold") {
633 gFontStylesReal[1] = style1 +
"-" + style2;
634 }
else if (style2 ==
"i") {
636 gFontStylesReal[3] = style1 +
"-" + style2;
637 }
else if (style2 ==
"o") {
639 gFontStylesReal[3] = style1 +
"-" + style2;
641 }
else if (style1 ==
"(null)") {
643 gFontStylesReal[0] =
"normal-r";
645 gFontStylesReal[1] =
"bold-r";
647 gFontStylesReal[2] =
"normal-i";
649 gFontStylesReal[3] =
"bold-i";
653 n2 = name.
Index(
"-", n1);
655 n2 = name.
Index(
"-", n1);
660 n2 = name.
Index(
"-", n1);
661 sz =
name(n1, n2 - n1);
666 all_sizes = (sz ==
"0") && !x11;
682 if (all_styles || styles[i]) {
688 if (nostyles && x11) {
741 const char *size, *
name;
761 if (sel < 0) sel = 0;
786 const char *rgstry =
"*";
788 if ((
fName ==
"Symbol") || (
fName ==
"Webdings") || (
fName ==
"Wingdings")) {
789 rgstry =
"microsoft";
794 gFontStylesReal[sel].
Data(), size, rgstry);
863 n1 = name.
Index(
"-", 1);
864 n2 = name.
Index(
"-", n1 + 1);
866 family =
name(n1, n2 - n1);
875 n2 = name.
Index(
"-", n1);
877 style1 =
name(n1, n2 - n1);
880 n2 = name.
Index(
"-", n1);
884 style2 =
name(n1, n2 - n1);
886 if ((style1 ==
"normal") || (style1 ==
"medium")) {
889 }
else if (style2 ==
"i") {
891 }
else if (style2 ==
"o") {
894 }
else if (style1 ==
"bold") {
897 }
else if (style2 ==
"i") {
899 }
else if (style2 ==
"o") {
904 n2 = name.
Index(
"-", n1);
906 n2 = name.
Index(
"-", n1);
908 n2 = name.
Index(
"-", n1);
912 n2 = name.
Index(
"-", n1);
913 sz =
name(n1, n2 - n1);
static const char * gFontStyles[]
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
virtual void SetFont(TGFont *font)
Set font.
virtual ~TGFontDialog()
Delete all widgets.
ClassImp(TGFontDialog) TGFontDialog
Create font dialog.
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
virtual Int_t GetSelected() const
Return id of selected listbox item.
R__EXTERN Int_t gErrorIgnoreLevel
static const char * gFDLG_DEFAULTSAMPLE
virtual void CloseWindow()
Called when window is closed via window manager.
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual void UpdateStyleSize(const char *family)
Build font style and size list boxes.
virtual void EnableAlign(Bool_t on=kTRUE)
Enable/disable align combobox.
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
Remove a range of entries defined by from_ID and to_ID.
virtual void Layout()
Layout the elements of the composite frame.
virtual void ColorSelected(Pixel_t c)
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Bool_t Build(char **fontList, Int_t cnt)
Build font dialog.
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...
std::vector< std::vector< double > > Data
void FreeGC(const TGGC *gc)
Free a graphics context.
virtual void SortByName(Bool_t ascend=kTRUE)
Sort entries by name.
void Error(const char *location, const char *msgfmt,...)
virtual UInt_t GetDefaultWidth() const
virtual TGLBEntry * Select(Int_t id, Bool_t sel=kTRUE)
virtual Int_t GetSelected() const
virtual void FontSelected(char *font)
virtual UInt_t GetDefaultWidth() const
virtual UInt_t GetDefaultHeight() const
virtual const char * GetName() const
Returns name of object.
TSubString Strip(EStripType s=kTrailing, char c= ' ') const
Return a substring of self stripped at beginning and/or end.
virtual void SetEnabled(Bool_t on=kTRUE)
Set state of combo box. If kTRUE=enabled, kFALSE=disabled.
virtual void SetColor(Pixel_t color)
Set color.
virtual void AlignSelected(Int_t a)
static const char * gFontSizes[]
static const char * gAlignTypes[]
virtual TGLBEntry * GetSelectedEntry() const
void GetFontName()
Sets fLName and other data members.
const Mask_t kGCForeground
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
virtual void Layout()
Layout the listbox components.
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
virtual void UnmapWindow()
virtual UInt_t GetDefaultHeight() const
void SetTextJustify(Int_t tmode)
Set text justification.
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle dialog events.
static const Int_t gAlignValues[]
TGColorSelect * fColorSelect
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
const char * GetString() const
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
const TGString * GetText() const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual void SetAlign(Int_t align)
Set align.
static Pixel_t GetBlackPixel()
Get black pixel value.
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.