本文整理汇总了C++中wxTextAttr::GetFont方法的典型用法代码示例。如果您正苦于以下问题:C++ wxTextAttr::GetFont方法的具体用法?C++ wxTextAttr::GetFont怎么用?C++ wxTextAttr::GetFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxTextAttr
的用法示例。
在下文中一共展示了wxTextAttr::GetFont方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Combine
/* static */
wxTextAttr wxTextAttr::Combine(const wxTextAttr& attr,
const wxTextAttr& attrDef,
const wxTextCtrlBase *text)
{
wxFont font;
if (attr.HasFont())
font = attr.GetFont();
if ( !font.Ok() )
{
if (attrDef.HasFont())
font = attrDef.GetFont();
if ( text && !font.Ok() )
font = text->GetFont();
}
wxColour colFg = attr.GetTextColour();
if ( !colFg.Ok() )
{
colFg = attrDef.GetTextColour();
if ( text && !colFg.Ok() )
colFg = text->GetForegroundColour();
}
wxColour colBg = attr.GetBackgroundColour();
if ( !colBg.Ok() )
{
colBg = attrDef.GetBackgroundColour();
if ( text && !colBg.Ok() )
colBg = text->GetBackgroundColour();
}
wxTextAttr newAttr(colFg, colBg, font);
if (attr.HasAlignment())
newAttr.SetAlignment(attr.GetAlignment());
else if (attrDef.HasAlignment())
newAttr.SetAlignment(attrDef.GetAlignment());
if (attr.HasTabs())
newAttr.SetTabs(attr.GetTabs());
else if (attrDef.HasTabs())
newAttr.SetTabs(attrDef.GetTabs());
if (attr.HasLeftIndent())
newAttr.SetLeftIndent(attr.GetLeftIndent(), attr.GetLeftSubIndent());
else if (attrDef.HasLeftIndent())
newAttr.SetLeftIndent(attrDef.GetLeftIndent(), attr.GetLeftSubIndent());
if (attr.HasRightIndent())
newAttr.SetRightIndent(attr.GetRightIndent());
else if (attrDef.HasRightIndent())
newAttr.SetRightIndent(attrDef.GetRightIndent());
return newAttr;
}
示例2: wxGtkTextInsert
static void wxGtkTextInsert(GtkWidget *text,
const wxTextAttr& attr,
const char *txt,
size_t len)
{
wxFont tmpFont;
GdkFont *font;
if (attr.HasFont())
{
tmpFont = attr.GetFont();
// FIXME: if this crashes because tmpFont goes out of scope and the GdkFont is
// deleted, then we need to call gdk_font_ref on font.
// This is because attr.GetFont() now returns a temporary font since wxTextAttr
// no longer stores a wxFont object, for efficiency.
font = tmpFont.GetInternalFont();
}
else
font = NULL;
GdkColor *colFg = attr.HasTextColour() ? attr.GetTextColour().GetColor()
: NULL;
GdkColor *colBg = attr.HasBackgroundColour()
? attr.GetBackgroundColour().GetColor()
: NULL;
gtk_text_insert( GTK_TEXT(text), font, colFg, colBg, txt, len );
}
示例3: wxPanel
TranslDlg::TranslDlg(wxWindow *parent) : wxPanel(parent)
{//=====================================================
int height;
int width;
int x,y;
int font_size;
int height_ph = 350;
wxTextAttr attr;
wxFont font = wxFont(12,wxFONTFAMILY_ROMAN,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_LIGHT,false,_T(""),wxFONTENCODING_SYSTEM);
attr.SetFont(font);
wxClientDisplayRect(&x,&y,&width, &height);
#ifdef PLATFORM_WINDOWS
if(height <= 768)
height_ph = height - 416;
#else
if(height <= 800)
height_ph = 280;
#endif
t_source = new wxTextCtrl(this,T_SOURCE,_T(""),wxPoint(0,4),
wxSize(298,250),wxTE_MULTILINE,wxDefaultValidator,_T("Text input window"));
t_source->SetDefaultStyle(attr);
t_phonetic = new wxTextCtrl(this,T_PHONETIC,_T(""),wxPoint(0,262),
wxSize(298,height_ph),wxTE_MULTILINE | wxTE_READONLY, wxDefaultValidator,_T("Phoneme translation window"));
style_phonetic = t_phonetic->GetDefaultStyle();
font_phonetic = style_phonetic.GetFont();
font_size = font_phonetic.GetPointSize();
font_phonetic_large = font_phonetic;
style_phonetic_large = style_phonetic;
//font_phonetic_large.SetFamily(wxFONTFAMILY_SWISS);
font_phonetic_large.SetPointSize(font_size+1);
style_phonetic_large.SetFont(font_phonetic_large);
y = height_ph + 270;
t_translate = new wxButton(this,T_TRANSLATE,_T("Translate"),wxPoint(4,y));
t_translate = new wxButton(this,T_RULES,_T("Show Rules"),wxPoint(4,y+32));
t_translate = new wxButton(this,T_TRANSLATE_IPA,_T("Show IPA"),wxPoint(100,y+32));
t_process = new wxButton(this,T_PROCESS,_T("Speak"),wxPoint(100,y));
t_source->SetFocus();
} // end of TransDlg::TransDlg
示例4: PrintTextAttr
void PrintTextAttr(wxTextAttr &textattr){
wxFont font = textattr.GetFont();
printf("TextAttr is:\n");
printf("\tName: %s\n", font.GetFaceName().ToAscii());
printf("\tSize: %d\n", font.GetPointSize());
printf("\tStyle:%s%s%s\n", font.GetWeight() == wxFONTWEIGHT_BOLD? " Bold" : "",
font.GetStyle() == wxFONTSTYLE_ITALIC? " Itallic" : "",
font.GetUnderlined()? " Underlined" : "");
wxColor textcolor = textattr.GetTextColour();
wxColor bgcolor = textattr.GetBackgroundColour();
printf("\ttextcolor: %02x%02x%02x\n", textcolor.Red(), textcolor.Green(), textcolor.Blue());
printf("\tbgcolor: %02x%02x%02x\n", bgcolor.Red(), bgcolor.Green(), bgcolor.Blue());
}
示例5: wxGtkTextInsert
static void wxGtkTextInsert(GtkWidget *text,
const wxTextAttr& attr,
const char *txt,
size_t len)
{
GdkFont *font = attr.HasFont() ? attr.GetFont().GetInternalFont()
: NULL;
GdkColor *colFg = attr.HasTextColour() ? attr.GetTextColour().GetColor()
: NULL;
GdkColor *colBg = attr.HasBackgroundColour()
? attr.GetBackgroundColour().GetColor()
: NULL;
gtk_text_insert( GTK_TEXT(text), font, colFg, colBg, txt, len );
}