本文整理汇总了C++中IScheme类的典型用法代码示例。如果您正苦于以下问题:C++ IScheme类的具体用法?C++ IScheme怎么用?C++ IScheme使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IScheme类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: scheme
//-----------------------------------------------------------------------------
// 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);
}
示例3: GetFocusNavGroup
//-----------------------------------------------------------------------------
// Purpose: lays out controls
//-----------------------------------------------------------------------------
void CConsolePanel::PerformLayout()
{
BaseClass::PerformLayout();
// setup tab ordering
GetFocusNavGroup().SetDefaultButton(m_pSubmit);
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
m_pEntry->SetBorder(pScheme->GetBorder("DepressedButtonBorder"));
m_pHistory->SetBorder(pScheme->GetBorder("DepressedButtonBorder"));
// layout controls
int wide, tall;
GetSize(wide, tall);
if ( !m_bStatusVersion )
{
const int inset = 8;
const int entryHeight = 24;
const int topHeight = 4;
const int entryInset = 4;
const int submitWide = 64;
const int submitInset = 7; // x inset to pull the submit button away from the frame grab
m_pHistory->SetPos(inset, inset + topHeight);
m_pHistory->SetSize(wide - (inset * 2), tall - (entryInset * 2 + inset * 2 + topHeight + entryHeight));
m_pHistory->InvalidateLayout();
int nSubmitXPos = wide - ( inset + submitWide + submitInset );
m_pSubmit->SetPos( nSubmitXPos, tall - (entryInset * 2 + entryHeight));
m_pSubmit->SetSize( submitWide, entryHeight);
m_pEntry->SetPos( inset, tall - (entryInset * 2 + entryHeight) );
m_pEntry->SetSize( nSubmitXPos - entryInset - 2 * inset, entryHeight);
}
else
{
const int inset = 2;
int entryWidth = wide / 2;
if ( wide > 400 )
{
entryWidth = 200;
}
m_pEntry->SetBounds( inset, inset, entryWidth, tall - 2 * inset );
m_pHistory->SetBounds( inset + entryWidth + inset, inset, ( wide - entryWidth ) - inset, tall - 2 * inset );
}
UpdateCompletionListPosition();
}
示例4: scheme
void MenuBar::Paint()
{
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
for ( int i = 0; i < m_pMenuButtons.Count(); i++)
{
if (!m_pMenuButtons[i]->IsArmed())
m_pMenuButtons[i]->SetDefaultBorder(NULL);
else
{
m_pMenuButtons[i]->SetDefaultBorder(pScheme->GetBorder( "ButtonBorder"));
}
}
}
示例5: scheme
void ImageButton::UpdateColors()
{
if (m_bButtonEnabled)
{
if (m_pLabel)
{
if (!IsCursorOver() || !m_bDoMouseOvers)
m_pLabel->SetFgColor(m_TextColor);
else
m_pLabel->SetFgColor(m_MouseOverTextColor);
}
if (m_pBackdrop)
{
m_pBackdrop->SetDrawColor(m_ImageColor);
}
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
if (pScheme)
{
int bg = GetPaintBackgroundType();
SetBorder(pScheme->GetBorder(m_szBorder));
SetPaintBackgroundType(bg);
}
}
else
{
if (m_pLabel)
{
m_pLabel->SetFgColor(m_DisabledTextColor);
}
if (m_pBackdrop)
{
m_pBackdrop->SetDrawColor(m_DisabledImageColor);
}
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
if (pScheme)
{
int bg = GetPaintBackgroundType();
SetBorder(pScheme->GetBorder(m_szBorderDisabled));
SetPaintBackgroundType(bg);
}
}
}
示例6: GetTrackRect
//-----------------------------------------------------------------------------
// 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 ] ) );
}
}
示例7: scheme
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Color CHudChat::GetTextColorForClient( TextColor colorNum, int clientIndex )
{
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
if ( pScheme == NULL )
return Color( 255, 255, 255, 255 );
Color c;
switch ( colorNum )
{
case COLOR_PLAYERNAME:
c = GetClientColor( clientIndex );
break;
case COLOR_LOCATION:
c = g_ColorDarkGreen;
break;
case COLOR_ACHIEVEMENT:
{
IScheme *pSourceScheme = scheme()->GetIScheme( scheme()->GetScheme( "SourceScheme" ) );
if ( pSourceScheme )
{
c = pSourceScheme->GetColor( "SteamLightGreen", GetBgColor() );
}
else
{
c = pScheme->GetColor( "TFColors.ChatTextYellow", GetBgColor() );
}
}
break;
default:
c = pScheme->GetColor( "TFColors.ChatTextYellow", GetBgColor() );
}
return Color( c[0], c[1], c[2], 255 );
}
示例8: TextImage
// 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;
}
}
示例9: sizeof
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void Label::ApplySettings( KeyValues *inResourceData )
{
BaseClass::ApplySettings( inResourceData );
// label settings
const char *labelText = inResourceData->GetString( "labelText", NULL );
if ( labelText )
{
if (labelText[0] == '%' && labelText[strlen(labelText) - 1] == '%')
{
// it's a variable, set it to be a special variable localized string
wchar_t unicodeVar[256];
g_pVGuiLocalize->ConvertANSIToUnicode(labelText, unicodeVar, sizeof(unicodeVar));
char var[256];
_snprintf(var, sizeof(var), "#var_%s", labelText);
g_pVGuiLocalize->AddString(var + 1, unicodeVar, "");
SetText(var);
}
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() );
//.........这里部分代码省略.........
示例10: SetImage
//-----------------------------------------------------------------------------
// Purpose: Applies designer settings from res file
//-----------------------------------------------------------------------------
void ImagePanel::ApplySettings(KeyValues *inResourceData)
{
delete [] m_pszImageName;
delete [] m_pszFillColorName;
delete [] m_pszDrawColorName; // HPE addition
m_pszImageName = NULL;
m_pszFillColorName = NULL;
m_pszDrawColorName = NULL; // HPE addition
//Center image isn't implemented in Source 2013. - Solokiller
m_bCenterImage = inResourceData->GetInt( "centerImage", 0 ) != 0;
m_bScaleImage = inResourceData->GetInt("scaleImage", 0) != 0;
m_fScaleAmount = inResourceData->GetFloat( "scaleAmount", 0.0f );
m_bTileImage = inResourceData->GetInt( "tileImage", 0 ) != 0;
m_bTileHorizontally = inResourceData->GetInt( "tileHorizontally", m_bTileImage ) != 0;
m_bTileVertically = inResourceData->GetInt( "tileVertically", m_bTileImage ) != 0;
const char *imageName = inResourceData->GetString("image", "");
if (*imageName)
{
SetImage( imageName );
}
const char *pszFillColor = inResourceData->GetString("fillcolor", "");
if (*pszFillColor)
{
int r = 0, g = 0, b = 0, a = 255;
int len = Q_strlen(pszFillColor) + 1;
m_pszFillColorName = new char[ len ];
Q_strncpy( m_pszFillColorName, pszFillColor, len );
if (sscanf(pszFillColor, "%d %d %d %d", &r, &g, &b, &a) >= 3)
{
// it's a direct color
m_FillColor = SDK_Color(r, g, b, a);
}
else
{
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
m_FillColor = pScheme->GetColor(pszFillColor, SDK_Color(0, 0, 0, 0));
}
}
//=============================================================================
// HPE_BEGIN:
// [pfreese] Added support for specifying drawcolor
//=============================================================================
const char *pszDrawColor = inResourceData->GetString( "drawcolor", "" );
if( *pszDrawColor )
{
int r = 255, g = 255, b = 255, a = 255;
int len = Q_strlen( pszDrawColor ) + 1;
m_pszDrawColorName = new char[ len ];
Q_strncpy( m_pszDrawColorName, pszDrawColor, len );
if( sscanf( pszDrawColor, "%d %d %d %d", &r, &g, &b, &a ) >= 3 )
{
// it's a direct color
m_DrawColor = SDK_Color( r, g, b, a );
}
else
{
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
m_DrawColor = pScheme->GetColor( pszDrawColor, SDK_Color( 255, 255, 255, 255 ) );
}
}
//=============================================================================
// HPE_END
//=============================================================================
const char *pszBorder = inResourceData->GetString("border", "");
if (*pszBorder)
{
IScheme *pScheme = scheme()->GetIScheme( GetScheme() );
SetBorder(pScheme->GetBorder(pszBorder));
}
BaseClass::ApplySettings(inResourceData);
}
示例11: catch
void CViewport::LoadDictionary(void)
{
CSV::CSVDocument doc;
CSV::CSVDocument::row_index_type row_count;
//Parse from the document
try
{
row_count = doc.load_file("captionmod/dictionary.csv");
}
catch(std::exception &err)
{
Sys_ErrorEx("%s\n%s", "LoadDictionary: ", err.what());
}
if(row_count < 2)
return;
IScheme *ischeme = scheme()->GetIScheme(GetScheme());
if(!ischeme)
return;
Color defaultColor = ischeme->GetColor("BaseText", Color(255, 255, 255, 200));
//Initialize the dictionary hashtable
m_StringsHashTable.SetSize(2048);
for (int i = 0; i < m_StringsHashTable.Count(); i++)
m_StringsHashTable[i].next = NULL;
EmptyDictionaryHash();
int nRowCount = row_count;
//parse the dictionary line by line...
for (int i = 1;i < nRowCount; ++i)
{
CSV::CSVDocument::row_type row = doc.get_row(i);
if(row.size() < 1)
continue;
const char *title = row[0].c_str();
if(!title || !title[0])
continue;
CDictionary *Dict = new CDictionary;
Dict->Load(row, defaultColor, ischeme);
m_Dictionary.AddToTail(Dict);
AddDictionaryHash(Dict, Dict->m_szTitle);
}
//Link the dictionaries
for(int i = 0; i < m_Dictionary.Count(); ++i)
{
CDictionary *Dict = m_Dictionary[i];
if(Dict->m_szNext[0])
{
Dict->m_pNext = FindDictionary(Dict->m_szNext);
}
}
}
示例12: ParseScriptFile
//-----------------------------------------------------------------------------
// Purpose: parses a script into sequences
//-----------------------------------------------------------------------------
bool AnimationController::ParseScriptFile(char *pMem, int length)
{
// get the scheme (for looking up color names)
IScheme *scheme = vgui::scheme()->GetIScheme(GetScheme());
// get our screen size (for left/right/center alignment)
int screenWide = m_nScreenBounds[ 2 ];
int screenTall = m_nScreenBounds[ 3 ];
// start by getting the first token
char token[512];
pMem = ParseFile(pMem, token, NULL);
while (token[0])
{
bool bAccepted = true;
// should be 'event'
if (stricmp(token, "event"))
{
Warning("Couldn't parse script file: expected 'event', found '%s'\n", token);
return false;
}
// get the event name
pMem = ParseFile(pMem, token, NULL);
if (strlen(token) < 1)
{
Warning("Couldn't parse script file: expected <event name>, found nothing\n");
return false;
}
int seqIndex;
UtlSymId_t nameIndex = g_ScriptSymbols.AddString(token);
// Create a new sequence
seqIndex = m_Sequences.AddToTail();
AnimSequence_t &seq = m_Sequences[seqIndex];
seq.name = nameIndex;
seq.duration = 0.0f;
// get the open brace or a conditional
pMem = ParseFile(pMem, token, NULL);
if ( Q_stristr( token, "[$" ) )
{
bAccepted = EvaluateConditional( token );
// now get the open brace
pMem = ParseFile(pMem, token, NULL);
}
if (stricmp(token, "{"))
{
Warning("Couldn't parse script sequence '%s': expected '{', found '%s'\n", g_ScriptSymbols.String(seq.name), token);
return false;
}
// walk the commands
while (token && token[0])
{
// get the command type
pMem = ParseFile(pMem, token, NULL);
// skip out when we hit the end of the sequence
if (token[0] == '}')
break;
// create a new command
int cmdIndex = seq.cmdList.AddToTail();
AnimCommand_t &animCmd = seq.cmdList[cmdIndex];
memset(&animCmd, 0, sizeof(animCmd));
if (!stricmp(token, "animate"))
{
animCmd.commandType = CMD_ANIMATE;
// parse out the animation commands
AnimCmdAnimate_t &cmdAnimate = animCmd.cmdData.animate;
// panel to manipulate
pMem = ParseFile(pMem, token, NULL);
cmdAnimate.panel = g_ScriptSymbols.AddString(token);
// variable to change
pMem = ParseFile(pMem, token, NULL);
cmdAnimate.variable = g_ScriptSymbols.AddString(token);
// target value
pMem = ParseFile(pMem, token, NULL);
if (cmdAnimate.variable == m_sPosition)
{
// Get first token
SetupPosition( cmdAnimate, &cmdAnimate.target.a, token, screenWide );
// Get second token from "token"
char token2[32];
char *psz = ParseFile(token, token2, NULL);
psz = ParseFile(psz, token2, NULL);
psz = token2;
// Position Y goes into ".b"
SetupPosition( cmdAnimate, &cmdAnimate.target.b, psz, screenTall );
}
//.........这里部分代码省略.........
示例13: sizeof
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void Label::ApplySettings( KeyValues *inResourceData )
{
Panel::ApplySettings( inResourceData );
// label settings
const char *labelText = inResourceData->GetString( "labelText", NULL );
if ( labelText )
{
if (labelText[0] == '%' && labelText[strlen(labelText) - 1] == '%')
{
// it's a variable, set it to be a special variable localized string
wchar_t unicodeVar[256];
g_pVGuiLocalize->ConvertANSIToUnicode(labelText, unicodeVar, sizeof(unicodeVar));
char var[256];
_snprintf(var, sizeof(var), "#var_%s", labelText);
g_pVGuiLocalize->AddString(var + 1, unicodeVar, "");
SetText(var);
}
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() );
//.........这里部分代码省略.........