本文整理汇总了C++中TextEntry类的典型用法代码示例。如果您正苦于以下问题:C++ TextEntry类的具体用法?C++ TextEntry怎么用?C++ TextEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: system
//-----------------------------------------------------------------------------
// Purpose: Adds lines to the text entry every second.
//-----------------------------------------------------------------------------
void TextEntryDemo4::OnTick()
{
if (m_iTimeoutTime)
{
int currentTime = system()->GetTimeMillis();
// Check for timeout
if (currentTime > m_iTimeoutTime)
{
char buf[125];
sprintf (buf, "Additional Text %d\n", m_iTimeoutTime);
// Move to the end of the history before we add some new text.
// Its important to call this and explicitly move to the
// correct position in case someone clicked in
// the window (this moves the cursor)
// If you comment out this line and rerun you will see
// that if you click in the text window additional
// text will be added where you clicked.
m_pTextEntry->DoGotoTextEnd();
// Add some text to the text entry window
m_pTextEntry->DoInsertString(buf);
// Timed out, make a new timeout time
m_iTimeoutTime = system()->GetTimeMillis() + TIMEOUT;
}
}
}
示例2: OnCommand
virtual void OnCommand( const char *command )
{
if ( !Q_strnicmp( command, "register", 8 ) )
{
if ( steamapicontext && steamapicontext->SteamFriends() )
{
steamapicontext->SteamFriends()->ActivateGameOverlayToWebPage( "http://www.youtube.com/create_account?next=/" );
}
}
else if ( !Q_strnicmp( command, "confirm", 7 ) )
{
TextEntry *pTextEntryUserName = dynamic_cast< TextEntry * >( FindChildByName( "UserNameTextEntry" ) );
TextEntry *pTextEntryPassword = dynamic_cast< TextEntry * >( FindChildByName( "PasswordTextEntry" ) );
if ( pTextEntryUserName && pTextEntryPassword )
{
char szUserName[256];
pTextEntryUserName->GetText( szUserName, sizeof( szUserName ) );
char szPassword[256];
pTextEntryPassword->GetText( szPassword, sizeof( szPassword ) );
youtube_username.SetValue( szUserName );
Login( szUserName, szPassword );
}
return;
}
BaseClass::OnCommand( command );
}
示例3: l_attr_text
static int l_attr_text(lua_State *l)
{
TextEntry *te = LuaObject<UI::TextEntry>::CheckFromLua(1);
const std::string &text(te->GetText());
lua_pushlstring(l, text.c_str(), text.size());
return 1;
}
示例4: l_set_color
static int l_set_color(lua_State *l)
{
TextEntry *te = LuaObject<UI::TextEntry>::CheckFromLua(1);
Color c = Color::FromLuaTable(l, 2);
te->SetColor(c);
lua_pushvalue(l, 1);
return 1;
}
示例5: SetControlText
//-----------------------------------------------------------------------------
// Purpose: Sets the text of a control by name
//-----------------------------------------------------------------------------
void CDialogGameInfo::SetControlText(const char *textEntryName, const char *text)
{
TextEntry *entry = dynamic_cast<TextEntry *>(FindChildByName(textEntryName));
if (entry)
{
entry->SetText(text);
}
}
示例6: SetControlText
//-----------------------------------------------------------------------------
// Purpose: Sets the text of a control by name
//-----------------------------------------------------------------------------
void CConfigPanel::SetControlText(const char *textEntryName, const char *text)
{
TextEntry *entry = dynamic_cast<TextEntry *>(FindChildByName(textEntryName));
if (entry)
{
entry->SetText(text);
}
}
示例7: l_set_text
static int l_set_text(lua_State *l)
{
TextEntry *te = LuaObject<UI::TextEntry>::CheckFromLua(1);
std::string new_text;
pi_lua_generic_pull(l, 2, new_text);
te->SetText(new_text);
lua_pushvalue(l, 1);
return 1;
}
示例8: ApplySchemeSettings
virtual void ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
TextEntry *pTextEntryUserName = dynamic_cast< TextEntry * >( FindChildByName( "UserNameTextEntry" ) );
if ( pTextEntryUserName )
{
pTextEntryUserName->SetText( "" );
pTextEntryUserName->InsertString( youtube_username.GetString() );
}
}
示例9: SetChildText
//-----------------------------------------------------------------------------
// Purpose:
// Input : *panelName -
// *valueName -
//-----------------------------------------------------------------------------
void CDialogUserInfo::SetChildText(const char *panelName, const char *valueName)
{
TextEntry *text = dynamic_cast<TextEntry *>(FindChildByName(panelName));
if (text)
{
char buf[512];
strncpy(buf, GetDoc()->GetBuddy(m_iUserID)->Data()->GetString(valueName, ""), sizeof(buf) - 1);
buf[511] = 0;
text->SetText(buf);
}
}
示例10:
//-----------------------------------------------------------------------------
// Purpose: When the enter key is pressed we clear the textentry.
// To add a newline use ctrl-return.
//-----------------------------------------------------------------------------
void TextEntryDemo5::OnKeyCodeTyped(KeyCode code)
{
if (code == KEY_ENTER)
{
m_pTextEntry->SetText("");
}
DemoPage::OnKeyCodeTyped(code);
}
示例11: while
//-----------------------------------------------------------------------------
// Purpose: Creates all the controls in the game options list
//-----------------------------------------------------------------------------
void CCreateMultiplayerGameGameplayPage::LoadGameOptionsList()
{
// destroy any existing controls
mpcontrol_t *p, *n;
p = m_pList;
while ( p )
{
n = p->next;
//
delete p->pControl;
delete p->pPrompt;
delete p;
p = n;
}
m_pList = NULL;
// Go through desciption creating controls
CScriptObject *pObj;
pObj = m_pDescription->pObjList;
mpcontrol_t *pCtrl;
CheckButton *pBox;
TextEntry *pEdit;
ComboBox *pCombo;
CScriptListItem *pListItem;
Panel *objParent = m_pOptionsList;
while ( pObj )
{
pCtrl = new mpcontrol_t( objParent, "mpcontrol_t" );
pCtrl->type = pObj->type;
switch ( pCtrl->type )
{
case O_BOOL:
pBox = new CheckButton( pCtrl, "DescCheckButton", pObj->prompt );
pBox->SetSelected( pObj->fdefValue != 0.0f ? true : false );
pCtrl->pControl = (Panel *)pBox;
break;
case O_STRING:
case O_NUMBER:
pEdit = new TextEntry( pCtrl, "DescTextEntry");
pEdit->InsertString(pObj->defValue);
pCtrl->pControl = (Panel *)pEdit;
break;
case O_LIST:
pCombo = new ComboBox( pCtrl, "DescComboBox", 5, false );
pListItem = pObj->pListItems;
while ( pListItem )
{
pCombo->AddItem(pListItem->szItemText, NULL);
pListItem = pListItem->pNext;
}
pCombo->ActivateItemByRow((int)pObj->fdefValue);
pCtrl->pControl = (Panel *)pCombo;
break;
default:
break;
}
if ( pCtrl->type != O_BOOL )
{
pCtrl->pPrompt = new vgui::Label( pCtrl, "DescLabel", "" );
pCtrl->pPrompt->SetContentAlignment( vgui::Label::a_west );
pCtrl->pPrompt->SetTextInset( 5, 0 );
pCtrl->pPrompt->SetText( pObj->prompt );
}
pCtrl->pScrObj = pObj;
pCtrl->SetSize( 100, 28 );
//pCtrl->SetBorder( scheme()->GetBorder(1, "DepressedButtonBorder") );
m_pOptionsList->AddItem( pCtrl );
// Link it in
if ( !m_pList )
{
m_pList = pCtrl;
pCtrl->next = NULL;
}
else
{
mpcontrol_t *p;
p = m_pList;
while ( p )
{
if ( !p->next )
{
//.........这里部分代码省略.........
示例12: BuildStringSheet
void CSheet_Array::UpdateArrayBlocks( const int &dest_x, const int &dest_y )
{
int old_x, old_y;
old_x = old_y = 0;
char ***oldEntires = BuildStringSheet( old_x, old_y );
for ( int y = 0; y < old_y; y++ )
{
//for ( int x = 0; x < old_x; x++ )
m_hArray_Y_Major[y]->Purge();
delete m_hArray_Y_Major[y];
}
m_hArray_Y_Major.Purge();
int iCurItem = m_pArrayPanel->FirstItem();
while ( iCurItem != m_pArrayPanel->InvalidItemID() )
{
Panel *pA = m_pArrayPanel->GetItemLabel( iCurItem );
Panel *pB = m_pArrayPanel->GetItemPanel( iCurItem );
if ( pA != NULL )
pA->MarkForDeletion();
if ( pB != NULL )
pB->MarkForDeletion();
iCurItem = m_pArrayPanel->NextItem( iCurItem );
}
m_pArrayPanel->DeleteAllItems();
m_pArrayPanel->RemoveAll();
for ( int y = 0; y < dest_y; y++ )
{
CUtlVector< TextEntry* > *cur = new CUtlVector< TextEntry* >;
m_hArray_Y_Major.AddToTail( cur );
}
m_pArrayPanel->SetNumColumns( dest_y );
for ( int x = 0; x < dest_x; x++ )
{
for ( int y = 0; y < dest_y; y++ )
{
CUtlVector< TextEntry* > *cur = m_hArray_Y_Major[y];
TextEntry *pEntry = new TextEntry( m_pArrayPanel, "arrayslot" );
pEntry->AddActionSignalTarget( this );
cur->AddToTail( pEntry );
if ( x < old_x &&
y < old_y && oldEntires != NULL )
{
pEntry->SetText( oldEntires[x][y] );
}
else
pEntry->SetText( "0" );
Label *pHeader = NULL;
if ( y == 0 )
pHeader = new Label( m_pArrayPanel, "", VarArgs( "%i:", x ) );
m_pArrayPanel->AddItem( pHeader, pEntry );
pEntry->MakeReadyForUse();
pEntry->InvalidateLayout( true, true );
pEntry->SetBgColor( TOKENCHANNELS_SUPPORTED_COLOR );
}
}
m_pArrayPanel->SetFirstColumnWidth( 20 );
if ( oldEntires != NULL )
DestroyStringSheet( oldEntires, old_x, old_y );
}
示例13: while
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFOptionsAdvancedPanel::CreateControls()
{
BaseClass::CreateControls();
// Go through desciption creating controls
CScriptObject *pObj;
pObj = m_pDescription->pObjList;
mpcontrol_t *pCtrl;
CTFAdvCheckButton *pBox;
TextEntry *pEdit;
ComboBox *pCombo;
CTFAdvSlider *pScroll;
CTFAdvButton *pTitle;
CScriptListItem *pListItem;
Panel *objParent = m_pListPanel;
while (pObj)
{
//Msg("\nAdded: %s %s %f %f %i\n", pObj->prompt, pObj->cvarname, pObj->fcurValue, pObj->fdefValue, pObj->type);
if (pObj->type == O_OBSOLETE)
{
pObj = pObj->pNext;
continue;
}
pCtrl = new mpcontrol_t(objParent, "mpcontrol_t");
pCtrl->type = pObj->type;
switch (pCtrl->type)
{
case O_BOOL:
pBox = new CTFAdvCheckButton(pCtrl, "DescCheckButton", pObj->prompt);
pBox->SetSelected(pObj->fdefValue != 0.0f ? true : false);
pBox->SetCommandString(pObj->cvarname);
pBox->GetButton()->SetFontByString(m_pListPanel->GetFontString());
if (pObj->tooltip[0] != '\0')
{
wchar_t *pText = g_pVGuiLocalize->Find(pObj->tooltip);
if (pText != NULL)
{
char pszToolTipLocal[256];
wcstombs(pszToolTipLocal, pText, sizeof(pszToolTipLocal));
pBox->SetToolTip(pszToolTipLocal);
}
else
{
pBox->SetToolTip(pObj->tooltip);
}
}
pCtrl->pControl = (Panel *)pBox;
break;
case O_STRING:
case O_NUMBER:
pEdit = new TextEntry(pCtrl, "DescTextEntry");
pEdit->InsertString(pObj->defValue);
pCtrl->pControl = (Panel *)pEdit;
break;
case O_SLIDER:
pScroll = new CTFAdvSlider(pCtrl, "DescScrollEntry", pObj->prompt);
pScroll->SetValue(pObj->fdefValue);
pScroll->SetCommandString(pObj->cvarname);
pScroll->SetMinMax(pObj->fMin, pObj->fMax);
pScroll->GetButton()->SetFontByString(m_pListPanel->GetFontString());
pCtrl->pControl = (Panel *)pScroll;
break;
case O_LIST:
pCombo = new ComboBox(pCtrl, "DescComboBox", 5, false);
pListItem = pObj->pListItems;
while (pListItem)
{
pCombo->AddItem(pListItem->szItemText, NULL);
pListItem = pListItem->pNext;
}
pCombo->ActivateItemByRow((int)pObj->fdefValue);
pCtrl->pControl = (Panel *)pCombo;
break;
case O_CATEGORY:
pTitle = new CTFAdvButton(pCtrl, "DescTextTitle", pObj->prompt);
pTitle->SetEnabled(false);
pTitle->SetBorderByString("AdvSettingsTitleBorder");
pTitle->SetBorderVisible(true);
pTitle->GetButton()->SetFontByString("MenuSmallFont");
pCtrl->pControl = (Panel *)pTitle;
break;
default:
break;
}
if (pCtrl->type != O_BOOL && pCtrl->type != O_SLIDER && pCtrl->type != O_CATEGORY)
{
//.........这里部分代码省略.........
示例14: snd_surround_speakers
//=============================================================================
void Multiplayer::OnCommand(const char *command)
{
if( Q_stricmp( "#GameUI_Headphones", command ) == 0 )
{
CGameUIConVarRef snd_surround_speakers("Snd_Surround_Speakers");
snd_surround_speakers.SetValue( "0" );
}
else if ( char const *sz = StringAfterPrefix( command, "#GameUI_DownloadFilter_" ) )
{
CGameUIConVarRef cl_downloadfilter( "cl_downloadfilter" );
cl_downloadfilter.SetValue( sz );
}
else if ( char const *sz = StringAfterPrefix( command, "ColorBlind" ) )
{
CGameUIConVarRef cl_colorblind( "cl_colorblind" );
cl_colorblind.SetValue( sz );
}
else if ( char const *sz = StringAfterPrefix( command, "GameInstructor" ) )
{
CGameUIConVarRef gameinstructor_enable( "gameinstructor_enable" );
gameinstructor_enable.SetValue( !Q_stricmp( sz, "Enabled" ) );
}
else if ( char const *sz = StringAfterPrefix( command, "AllowFreeLook" ) )
{
CGameUIConVarRef spec_allowroaming( "spec_allowroaming" );
spec_allowroaming.SetValue( !Q_stricmp( sz, "Enabled" ) );
}
else if ( char const *sz = StringAfterPrefix( command, "MpLanGames" ) )
{
CGameUIConVarRef net_allow_multicast( "net_allow_multicast" );
net_allow_multicast.SetValue( !Q_stricmp( sz, "Enabled" ) );
}
else if ( StringHasPrefix( command, "_spraypaint" ) )
{
int iCommandNumberPosition = Q_strlen( MULTIPLAYER_SPRAYPAINT_COMMAND_PREFIX );
int iLogo = clamp( command[ iCommandNumberPosition ] - '0', 0, m_nNumSpraypaintLogos - 1 );
if ( m_nSpraypaint[ iLogo ].m_bCustom && m_nSpraypaint[ iLogo ].m_szFilename[ 0 ] == '\0' )
{
// Select a file from the custom directory!
if ( m_hSelectSprayDialog )
{
// Always start fresh so the directory refreshes
m_hSelectSprayDialog->DeletePanel();
m_hSelectSprayDialog = NULL;
}
m_hSelectSprayDialog = new FileOpenDialog(this, "#L4D360UI_Multiplayer_Cutsom_Logo", true);
m_hSelectSprayDialog->SetProportional( false );
m_hSelectSprayDialog->SetDeleteSelfOnClose( false );
m_hSelectSprayDialog->AddFilter("*.vtf", "*.vtf", true);
m_hSelectSprayDialog->AddActionSignalTarget(this);
char szCustomSprayDir[ MAX_PATH ];
Q_snprintf( szCustomSprayDir, sizeof( szCustomSprayDir ), "%s/" MULTIPLAYER_SPRAY_FOLDER MULTIPLAYER_CUSTOM_SPRAY_FOLDER, engine->GetGameDirectory() );
m_hSelectSprayDialog->SetStartDirectoryContext( "SelectCustomLogo", szCustomSprayDir );
m_hSelectSprayDialog->DoModal(false);
m_hSelectSprayDialog->Activate();
// Hide directory buttons
m_hSelectSprayDialog->SetControlVisible( "FolderUpButton", false );
m_hSelectSprayDialog->SetControlVisible( "NewFolderButton", false );
m_hSelectSprayDialog->SetControlVisible( "OpenInExplorerButton", false );
m_hSelectSprayDialog->SetControlVisible( "LookInLabel", false );
m_hSelectSprayDialog->SetControlVisible( "FullPathEdit", false );
m_hSelectSprayDialog->SetControlVisible( "FileNameLabel", false );
for ( int i = 0; i < m_hSelectSprayDialog->GetChildCount(); ++i )
{
// Need to hide text entry box so they can't manually type ".." and go back a dir
TextEntry *pTextEntry = dynamic_cast<TextEntry*>( m_hSelectSprayDialog->GetChild( i ) );
if ( pTextEntry && !dynamic_cast<ComboBox*>( pTextEntry ) )
{
pTextEntry->SetVisible( false );
}
}
}
else
{
char *pchCustomPath = ( ( m_nSpraypaint[ iLogo ].m_bCustom ) ? ( MULTIPLAYER_CUSTOM_SPRAY_FOLDER ) : ( "" ) );
char rootFilename[MAX_PATH];
Q_snprintf( rootFilename, sizeof(rootFilename), MULTIPLAYER_SPRAY_FOLDER "%s%s.vtf", pchCustomPath, m_nSpraypaint[ iLogo ].m_szFilename );
CGameUIConVarRef cl_logofile( "cl_logofile", true );
cl_logofile.SetValue( rootFilename );
RemapLogo( m_nSpraypaint[ iLogo ].m_szFilename, m_pSprayLogo, pchCustomPath );
// Clear out the custom image's filename so they will be forced to reselect
for ( int i = 0; i < MAX_SPRAYPAINT_LOGOS; ++i )
{
if ( m_nSpraypaint[ iLogo ].m_bCustom )
{
m_nSpraypaint[ iLogo ].m_szFilename[ 0 ] = '\0';
//.........这里部分代码省略.........
示例15: UpdateControlData
//-----------------------------------------------------------------------------
// Purpose: sets up the current control to edit
//-----------------------------------------------------------------------------
void BuildModeDialog::SetActiveControl(Panel *controlToEdit)
{
if (m_pCurrentPanel == controlToEdit)
{
// it's already set, so just update the property data and quit
if (m_pCurrentPanel)
{
UpdateControlData(m_pCurrentPanel);
}
return;
}
// reset the data
m_pCurrentPanel = controlToEdit;
RemoveAllControls();
m_pPanelList->m_pControls->MoveScrollBarToTop();
if (!m_pCurrentPanel)
{
m_pStatusLabel->SetText("[nothing currently selected]");
m_pStatusLabel->SetTextColorState(Label::CS_DULL);
RemoveAllControls();
return;
}
// get the control description string
const char *controlDesc = m_pCurrentPanel->GetDescription();
// parse out the control description
int tabPosition = 1;
while (1)
{
const char *dataType = ParseTokenFromString(&controlDesc);
// finish when we have no more tokens
if (*dataType == 0)
break;
// default the data type to a string
int datat = TYPE_STRING;
if (!stricmp(dataType, "int"))
{
datat = TYPE_STRING; //!! just for now
}
else if (!stricmp(dataType, "alignment"))
{
datat = TYPE_ALIGNMENT;
}
else if (!stricmp(dataType, "autoresize"))
{
datat = TYPE_AUTORESIZE;
}
else if (!stricmp(dataType, "corner"))
{
datat = TYPE_CORNER;
}
else if (!stricmp(dataType, "localize"))
{
datat = TYPE_LOCALIZEDSTRING;
}
// get the field name
const char *fieldName = ParseTokenFromString(&controlDesc);
int itemHeight = 18;
// build a control & label
Label *label = new Label(this, NULL, fieldName);
label->SetSize(96, itemHeight);
label->SetContentAlignment(Label::a_east);
TextEntry *edit = NULL;
ComboBox *editCombo = NULL;
Button *editButton = NULL;
if (datat == TYPE_ALIGNMENT)
{
// drop-down combo box
editCombo = new ComboBox(this, NULL, 9, false);
editCombo->AddItem("north-west", NULL);
editCombo->AddItem("north", NULL);
editCombo->AddItem("north-east", NULL);
editCombo->AddItem("west", NULL);
editCombo->AddItem("center", NULL);
editCombo->AddItem("east", NULL);
editCombo->AddItem("south-west", NULL);
editCombo->AddItem("south", NULL);
editCombo->AddItem("south-east", NULL);
edit = editCombo;
}
else if (datat == TYPE_AUTORESIZE)
{
// drop-down combo box
editCombo = new ComboBox(this, NULL, 4, false);
editCombo->AddItem( "0 - no auto-resize", NULL);
editCombo->AddItem( "1 - resize right", NULL);
//.........这里部分代码省略.........