当前位置: 首页>>代码示例>>C++>>正文


C++ IScheme::GetFont方法代码示例

本文整理汇总了C++中IScheme::GetFont方法的典型用法代码示例。如果您正苦于以下问题:C++ IScheme::GetFont方法的具体用法?C++ IScheme::GetFont怎么用?C++ IScheme::GetFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IScheme的用法示例。


在下文中一共展示了IScheme::GetFont方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BaseTooltip

//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
TextTooltip::TextTooltip(Panel *parent, const char *text) : BaseTooltip( parent, text )
{
	if (!s_TooltipWindow.Get())
	{
		s_TooltipWindow = new TextEntry(NULL, "tooltip");

 		s_TooltipWindow->InvalidateLayout(false, true);

		// this bit of hackery is necessary because tooltips don't get ApplySchemeSettings called from their parents
		IScheme *pScheme = scheme()->GetIScheme( s_TooltipWindow->GetScheme() );
		s_TooltipWindow->SetBgColor(s_TooltipWindow->GetSchemeColor("Tooltip.BgColor", s_TooltipWindow->GetBgColor(), pScheme));
		s_TooltipWindow->SetFgColor(s_TooltipWindow->GetSchemeColor("Tooltip.TextColor", s_TooltipWindow->GetFgColor(), pScheme));
		s_TooltipWindow->SetBorder(pScheme->GetBorder("ToolTipBorder"));
		s_TooltipWindow->SetFont( pScheme->GetFont("DefaultSmall", s_TooltipWindow->IsProportional()));
	}
	s_iTooltipWindowCount++;

	// this line prevents the main window from losing focus
	// when a tooltip pops up
	s_TooltipWindow->MakePopup(false, true);
	s_TooltipWindow->SetKeyBoardInputEnabled( false );
	s_TooltipWindow->SetMouseInputEnabled( false );
	
	SetText(text);
	s_TooltipWindow->SetText(m_Text.Base());
	s_TooltipWindow->SetEditable(false);
	s_TooltipWindow->SetMultiline(true);
	s_TooltipWindow->SetVisible(false);
}
开发者ID:Baer42,项目名称:source-sdk-2013,代码行数:32,代码来源:Tooltip.cpp

示例2: GetContentSize

//-----------------------------------------------------------------------------
// Purpose: Return the full size of the contained content
//-----------------------------------------------------------------------------
void Label::GetContentSize(int &wide, int &tall)
{
	if( GetFont() == INVALID_FONT ) // we haven't loaded our font yet, so load it now
	{
		IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
		if ( pScheme )
		{
			SetFont( pScheme->GetFont( "Default", IsProportional() ) );
		}
	}


	int tx0, ty0, tx1, ty1;
	ComputeAlignment(tx0, ty0, tx1, ty1);

	// the +8 is padding to the content size
	// the code which uses it should really set that itself; 
	// however a lot of existing code relies on this
	wide = (tx1 - tx0) + _textInset[0]; 

	// get the size of the text image and remove it
	int iWide, iTall;
	_textImage->GetSize(iWide, iTall);
	wide -=  iWide;
	// get the full, untruncated (no elipsis) size of the text image.
	_textImage->GetContentSize(iWide, iTall);
	wide += iWide;

	// addin the image offsets as well
	for (int i=0; i < _imageDar.Size(); i++)
		wide += _imageDar[i].offset;

	tall = max((ty1 - ty0) + _textInset[1], iTall);
}
开发者ID:Baer42,项目名称:source-sdk-2013,代码行数:37,代码来源:Label.cpp

示例3: DrawTickLabels

//-----------------------------------------------------------------------------
// Purpose: Draw Tick labels under the ticks.
//-----------------------------------------------------------------------------
void CLabeledSlider::DrawTickLabels()
{
	int x, y;
	int wide,tall;
	GetTrackRect( x, y, wide, tall );

	// Figure out how to draw the ticks
	GetPaintSize( wide, tall );

	float fwide  = (float)wide;
	float fnobsize = 8;
	float freepixels = fwide - fnobsize;

	float leftpixel = fnobsize / 2.0f;

	float pixelspertick = freepixels / ( m_nNumTicks );

	y =  y + (int)fnobsize + 4;

	// Draw Start and end range values
	surface()->DrawSetTextColor( Color( 127, 140, 127, 255 ) );
	
	surface()->DrawSetTextPos( 0, y);

	IScheme *pScheme = scheme()->GetIScheme( scheme()->GetDefaultScheme() );
	if ( m_szTickCaptions[ 0 ][ 0 ] )
	{
		surface()->DrawSetTextFont(pScheme->GetFont("DefaultVerySmall"));

		surface()->DrawPrintText( (const unsigned short *)m_szTickCaptions[ 0 ], strlen( m_szTickCaptions[ 0 ] ) );
	}

	if ( m_szTickCaptions[ 1 ][ 0 ] )
	{
		surface()->DrawSetTextFont(pScheme->GetFont("DefaultVerySmall"));

		// was 5 *  now is 2 *
		surface()->DrawSetTextPos( (int)( m_nNumTicks * pixelspertick - 2 * strlen( m_szTickCaptions[ 1 ] ) ), y);

		surface()->DrawPrintText((const unsigned short *) m_szTickCaptions[ 1 ], strlen( m_szTickCaptions[ 1 ] ) );
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:45,代码来源:LabeledSlider.cpp

示例4: SetDropMenuButtonStyle

// This style is like the IE "back" button where the left side acts like a regular button, the the right side has a little
//  combo box dropdown indicator and presents and submenu
void MenuButton::SetDropMenuButtonStyle( bool state )
{
	bool changed = m_bDropMenuButtonStyle != state;
	m_bDropMenuButtonStyle = state;
	if ( !changed )
		return;

	if ( state )
	{
		m_pDropMenuImage = new TextImage( "u" );
		IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
		m_pDropMenuImage->SetFont(pScheme->GetFont("Marlett", IsProportional()));
		// m_pDropMenuImage->SetContentAlignment(Label::a_west);
		// m_pDropMenuImage->SetTextInset(3, 0);
		m_nImageIndex = AddImage( m_pDropMenuImage, 0 );
	}
	else
	{
		ResetToSimpleTextImage();
		delete m_pDropMenuImage;
		m_pDropMenuImage = NULL;
		m_nImageIndex = -1;
	}
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:26,代码来源:MenuButton.cpp

示例5: ApplySettings


//.........这里部分代码省略.........
	else if ( !stricmp(alignmentString, "north-east") )
	{
		align = a_northeast;
	}
	else if ( !stricmp(alignmentString, "west") )
	{
		align = a_west;
	}
	else if ( !stricmp(alignmentString, "center") )
	{
		align = a_center;
	}
	else if ( !stricmp(alignmentString, "east") )
	{
		align = a_east;
	}
	else if ( !stricmp(alignmentString, "south-west") )
	{
		align = a_southwest;
	}
	else if ( !stricmp(alignmentString, "south") )
	{
		align = a_south;
	}
	else if ( !stricmp(alignmentString, "south-east") )
	{
		align = a_southeast;
	}

	if ( align != -1 )
	{
		SetContentAlignment( (Alignment)align );
	}

	// the control we are to be associated with may not have been created yet,
	// so keep a pointer to it's name and calculate it when we can
	const char *associateName = inResourceData->GetString("associate", "");
	if (associateName[0] != 0)
	{
		int len = Q_strlen(associateName) + 1;
		_associateName = new char[ len ];
		Q_strncpy( _associateName, associateName, len );
	}

	if (inResourceData->GetInt("dulltext", 0) == 1)
	{
		SetTextColorState(CS_DULL);
	}
	else if (inResourceData->GetInt("brighttext", 0) == 1)
	{
		SetTextColorState(CS_BRIGHT);
	}
	else
	{
		SetTextColorState(CS_NORMAL);
	}

	// font settings
	const char *overrideFont = inResourceData->GetString("font", "");
	IScheme *pScheme = scheme()->GetIScheme( GetScheme() );

	if (*overrideFont)
	{
		delete [] _fontOverrideName;
		int len = Q_strlen(overrideFont) + 1;
		_fontOverrideName = new char[ len ];
		Q_strncpy(_fontOverrideName, overrideFont, len );
		SetFont(pScheme->GetFont(_fontOverrideName, IsProportional()));
	}
	else if (_fontOverrideName)
	{
		delete [] _fontOverrideName;
		_fontOverrideName = NULL;
		SetFont(pScheme->GetFont("Default", IsProportional()));
	}

	bool bWrapText = inResourceData->GetInt("centerwrap", 0) > 0;
	SetCenterWrap( bWrapText );

	m_bAutoWideToContents = inResourceData->GetInt("auto_wide_tocontents", 0) > 0;

	bWrapText = inResourceData->GetInt("wrap", 0) > 0;
	SetWrap( bWrapText );

	int inset_x = inResourceData->GetInt("textinsetx", _textInset[0]);
	int inset_y = inResourceData->GetInt("textinsety", _textInset[1]);
	// Had to play it safe and add a new key for backwards compatibility
	m_bUseProportionalInsets = inResourceData->GetInt("use_proportional_insets", 0) > 0;
	if ( m_bUseProportionalInsets )
	{
		inset_x = scheme()->GetProportionalScaledValueEx( GetScheme(), inset_x );
	}

	SetTextInset( inset_x, inset_y );

	bool bAllCaps = inResourceData->GetInt("allcaps", 0) > 0;
	SetAllCaps( bAllCaps );

	InvalidateLayout(true);
}
开发者ID:Baer42,项目名称:source-sdk-2013,代码行数:101,代码来源:Label.cpp

示例6: ApplySettings


//.........这里部分代码省略.........
		}
		else
		{
			SetText(labelText);
		}
	}

	// text alignment
	const char *alignmentString = inResourceData->GetString( "textAlignment", "" );
	int align = -1;

	if ( !stricmp(alignmentString, "north-west") )
	{
		align = a_northwest;
	}
	else if ( !stricmp(alignmentString, "north") )
	{
		align = a_north;
	}
	else if ( !stricmp(alignmentString, "north-east") )
	{
		align = a_northeast;
	}
	else if ( !stricmp(alignmentString, "west") )
	{
		align = a_west;
	}
	else if ( !stricmp(alignmentString, "center") )
	{
		align = a_center;
	}
	else if ( !stricmp(alignmentString, "east") )
	{
		align = a_east;
	}
	else if ( !stricmp(alignmentString, "south-west") )
	{
		align = a_southwest;
	}
	else if ( !stricmp(alignmentString, "south") )
	{
		align = a_south;
	}
	else if ( !stricmp(alignmentString, "south-east") )
	{
		align = a_southeast;
	}

	if ( align != -1 )
	{
		SetContentAlignment( (Alignment)align );
	}

	// the control we are to be associated with may not have been created yet,
	// so keep a pointer to it's name and calculate it when we can
	const char *associateName = inResourceData->GetString("associate", "");
	if (associateName[0] != 0)
	{
		int len = Q_strlen(associateName) + 1;
		_associateName = new char[ len ];
		Q_strncpy( _associateName, associateName, len );
	}

	if (inResourceData->GetInt("dulltext", 0) == 1)
	{
		SetTextColorState(CS_DULL);
	}
	else if (inResourceData->GetInt("brighttext", 0) == 1)
	{
		SetTextColorState(CS_BRIGHT);
	}
	else
	{
		SetTextColorState(CS_NORMAL);
	}

	// font settings
	const char *overrideFont = inResourceData->GetString("font", "");
	IScheme *pScheme = scheme()->GetIScheme( GetScheme() );

	if (*overrideFont)
	{
		delete [] _fontOverrideName;
		int len = Q_strlen(overrideFont) + 1;
		_fontOverrideName = new char[ len ];
		Q_strncpy(_fontOverrideName, overrideFont, len );
		SetFont(pScheme->GetFont(_fontOverrideName, IsProportional()));
	}
	else if (_fontOverrideName)
	{
		delete [] _fontOverrideName;
		_fontOverrideName = NULL;
		SetFont(pScheme->GetFont("Default", IsProportional()));
	}

	bool bWrapText = inResourceData->GetInt("wrap", 0) > 0;
	SetWrap( bWrapText );

	InvalidateLayout(true);
}
开发者ID:TrentSterling,项目名称:D0G,代码行数:101,代码来源:Label.cpp


注:本文中的IScheme::GetFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。