本文整理汇总了C++中wxFont类的典型用法代码示例。如果您正苦于以下问题:C++ wxFont类的具体用法?C++ wxFont怎么用?C++ wxFont使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxFont类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetFontToUse
void wxMenuItem::GetFontToUse(wxFont& font) const
{
font = GetFont();
if ( !font.IsOk() )
font = MenuDrawData::Get()->Font;
}
开发者ID:emutavchi,项目名称:pxCore,代码行数:6,代码来源:menuitem.cpp
示例2: if
// Get attributes from font.
bool wxTextAttr::GetFontAttributes(const wxFont& font, int flags)
{
if (!font.IsOk())
return false;
// If we pass both pixel and point size attributes, this is an indication
// to choose the most appropriate units.
if ((flags & wxTEXT_ATTR_FONT) == wxTEXT_ATTR_FONT)
{
if (font.IsUsingSizeInPixels())
{
m_fontSize = font.GetPixelSize().y;
flags &= ~wxTEXT_ATTR_FONT_POINT_SIZE;
}
else
{
m_fontSize = font.GetPointSize();
flags &= ~wxTEXT_ATTR_FONT_PIXEL_SIZE;
}
}
else if (flags & wxTEXT_ATTR_FONT_POINT_SIZE)
{
m_fontSize = font.GetPointSize();
flags &= ~wxTEXT_ATTR_FONT_PIXEL_SIZE;
}
else if (flags & wxTEXT_ATTR_FONT_PIXEL_SIZE)
{
m_fontSize = font.GetPixelSize().y;
}
if (flags & wxTEXT_ATTR_FONT_ITALIC)
m_fontStyle = font.GetStyle();
if (flags & wxTEXT_ATTR_FONT_WEIGHT)
m_fontWeight = font.GetWeight();
if (flags & wxTEXT_ATTR_FONT_UNDERLINE)
m_fontUnderlined = font.GetUnderlined();
if (flags & wxTEXT_ATTR_FONT_STRIKETHROUGH)
m_fontStrikethrough = font.GetStrikethrough();
if (flags & wxTEXT_ATTR_FONT_FACE)
m_fontFaceName = font.GetFaceName();
if (flags & wxTEXT_ATTR_FONT_ENCODING)
m_fontEncoding = font.GetEncoding();
if (flags & wxTEXT_ATTR_FONT_FAMILY)
{
// wxFont might not know its family, avoid setting m_fontFamily to an
// invalid value and rather pretend that we don't have any font family
// information at all in this case
const wxFontFamily fontFamily = font.GetFamily();
if ( fontFamily == wxFONTFAMILY_UNKNOWN )
flags &= ~wxTEXT_ATTR_FONT_FAMILY;
else
m_fontFamily = fontFamily;
}
m_flags |= flags;
return true;
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:65,代码来源:textcmn.cpp
示例3: scale_metadata_font
// Transform function for metadata fonts
wxFont scale_metadata_font(const wxFont & font)
{
return font.Scaled(.9);
}
开发者ID:oeuftete,项目名称:wx-xword,代码行数:5,代码来源:config.cpp
示例4: SetSQLFont
void sysSettings::SetSQLFont(const wxFont &font)
{
wxString fontName = font.GetNativeFontInfoDesc();
Write(wxT("frmQuery/Font"), fontName);
}
开发者ID:lhcezar,项目名称:pgadmin3,代码行数:6,代码来源:sysSettings.cpp
示例5: scale_heading_font
// Transform function for headingFont
wxFont scale_heading_font(const wxFont & font)
{
return font.Scaled(1.2);
}
开发者ID:oeuftete,项目名称:wx-xword,代码行数:5,代码来源:config.cpp
示例6: GetTextExtent
void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading )
{
HDC dc = GetDC(0);
WXHFONT hFont = font.GetHFONT();
::SelectObject(dc, hFont);
HFONT hfontOld;
if ( font != wxNullFont )
{
wxASSERT_MSG( font.Ok(), _T("invalid font in wxDC::GetTextExtent") );
hfontOld = (HFONT)::SelectObject(dc, hFont);
}
else // don't change the font
{
hfontOld = 0;
}
SIZE sizeRect;
const size_t len = str.length();
if ( !::GetTextExtentPoint32(dc, str, len, &sizeRect) )
{
wxLogLastError(_T("GetTextExtentPoint32()"));
}
#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400)
// the result computed by GetTextExtentPoint32() may be too small as it
// accounts for under/overhang of the first/last character while we want
// just the bounding rect for this string so adjust the width as needed
// (using API not available in 2002 SDKs of WinCE)
if ( len > 1 )
{
ABC width;
const wxChar chFirst = *str.begin();
if ( ::GetCharABCWidths(dc, chFirst, chFirst, &width) )
{
if ( width.abcA < 0 )
sizeRect.cx -= width.abcA;
if ( len > 1 )
{
const wxChar chLast = *str.rbegin();
::GetCharABCWidths(dc, chLast, chLast, &width);
}
//else: we already have the width of the last character
if ( width.abcC < 0 )
sizeRect.cx -= width.abcC;
}
//else: GetCharABCWidths() failed, not a TrueType font?
}
#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400)
TEXTMETRIC tm;
::GetTextMetrics(dc, &tm);
if (width)
*width = sizeRect.cx;
if (height)
*height = sizeRect.cy;
if (descent)
*descent = tm.tmDescent;
if (externalLeading)
*externalLeading = tm.tmExternalLeading;
if ( hfontOld )
{
::SelectObject(dc, hfontOld);
}
ReleaseDC(0, dc);
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:73,代码来源:fontprops.cpp
示例7: FontToString
// wxFont
static wxString FontToString(const wxFont & font)
{ return font.GetNativeFontInfoUserDesc(); }
开发者ID:brho,项目名称:xword,代码行数:3,代码来源:ConfigManager.hpp
示例8: SetFont
void wxQtDCImpl::SetFont(const wxFont& font)
{
m_font = font;
m_qtPainter->setFont(font.GetHandle());
}
开发者ID:781155640,项目名称:wxWidgets,代码行数:6,代码来源:dc.cpp
示例9: SetFont
bool wxWindowQt::SetFont( const wxFont &font )
{
GetHandle()->setFont( font.GetHandle() );
return ( true );
}
开发者ID:781155640,项目名称:wxWidgets,代码行数:6,代码来源:window.cpp
示例10: Draw
void SjOscTitle::Draw(wxDC& dc, const wxSize& clientSize, bool titleChanged, const wxString& newTitle)
{
// client size changed?
if( m_clientSize != clientSize )
{
m_clientSize = clientSize;
// create new font
int pt = clientSize.y / 20; if( pt < 7 ) pt = 7;
m_font.SetPointSize(pt);
// calculate new size
CalcCurrTitleSize(dc);
}
// title changed?
if( titleChanged )
{
if( m_currTitle.IsEmpty() )
{
m_currTitle = newTitle;
CalcCurrTitleSize(dc);
m_titleOp = TITLEOP_WIPEIN;
m_titleWipe = 0.0F;
}
else if( m_titleOp == TITLEOP_WIPEIN )
{
m_nextTitle = newTitle; // fast switch - however, this only happens for very short tracks
CalcCurrTitleSize(dc);
}
else if( newTitle != m_currTitle )
{
m_nextTitle = newTitle;
CalcCurrTitleSize(dc);
if( m_titleOp == TITLEOP_NOP )
{
m_titleOp = TITLEOP_WIPEOUT;
m_titleWipe = 0.0F;
}
}
}
// draw the title
dc.SetFont(m_font);
// scroll?
#define SCROLL_PIX 8
#define SCROLL_INITIAL_WAIT_MS 2000
#define SCROLL_LEFT_END_WAIT_MS 2000
#define SCROLL_RIGHT_END_WAIT_MS 12000
if( m_scroll == SCROLL_WAIT )
{
m_scrollCnt--;
if( m_scrollCnt <= 0 )
{
m_scroll = m_currTitleX<0? SCROLL_RIGHT : SCROLL_LEFT;
}
}
else if( m_scroll == SCROLL_LEFT )
{
m_currTitleX -= SCROLL_PIX;
if( m_currTitleX+m_currTitleW <= m_clientSize.x )
{
m_scroll = SCROLL_WAIT;
m_scrollCnt = (SCROLL_LEFT_END_WAIT_MS / SLEEP_MS);
}
}
else if( m_scroll == SCROLL_RIGHT )
{
m_currTitleX += SCROLL_PIX;
if( m_currTitleX >= 0 )
{
m_scroll = SCROLL_WAIT;
m_scrollCnt = (SCROLL_RIGHT_END_WAIT_MS / SLEEP_MS);
}
}
// apply our wipe effect
if( m_titleOp )
{
m_titleWipe += 1.0L/(double)SLEEP_MS;
wxRect wipeRect(0, m_currTitleY, m_clientSize.x, m_currTitleH);
if( m_titleOp == TITLEOP_WIPEIN )
{
wipeRect.width = (int) ( wipeRect.width * m_titleWipe );
}
else
{
wipeRect.x = (int) ( wipeRect.width * m_titleWipe );
}
// clip out the wipe rectangle and draw the text
//dc.DrawRectangle(wipeRect);
dc.SetClippingRegion(wipeRect);
dc.DrawText(m_currTitle, m_currTitleX, m_currTitleY);
dc.DestroyClippingRegion();
// this wipe done?
//.........这里部分代码省略.........
开发者ID:antonivich,项目名称:Silverjuke,代码行数:101,代码来源:vis_oscilloscope.cpp
注:本文中的wxFont类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论