本文整理汇总了C++中SetText函数的典型用法代码示例。如果您正苦于以下问题:C++ SetText函数的具体用法?C++ SetText怎么用?C++ SetText使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetText
bool CButton::ProcessInput( const TInputMsg & tData )
{
if ( IsMouseOver( g_pUIManager->GetMousePos() ) )
SetText( "Over" );
else
SetText( "OK" );
switch ( tData.eType )
{
case IMT_MOUSE_MOVE_X:
case IMT_MOUSE_MOVE_Y:
{
if ( IsMouseOver( g_pUIManager->GetMousePos() ) )
{
if ( this == g_pUIManager->GetActiveControl() )
{
m_bPressed = true;
}
}
else
{
m_bPressed = false;
}
}
break;
case IMT_MOUSE_LKEY:
{
if ( IsMouseOver( g_pUIManager->GetMousePos() ) )
{
if ( tData.dwData & 0x80 )
{
Press();
g_pUIManager->SetActiveControl( this );
}
else
{
if ( this == g_pUIManager->GetActiveControl() )
{
g_pUIManager->SetActiveControl( NULL );
MessageBeep( MB_OK );
//if ( m_pParent )
// m_pParent->OnChildEvent( this );
Press( false );
}
}
return true;
}
else if ( this == g_pUIManager->GetActiveControl() )
{
if ( !( tData.dwData & 0x80 ) )
g_pUIManager->SetActiveControl( NULL );
}
}
break;
}
return false;
}
示例2: SetText
void cMenuEditItem::SetValue(const char *Value)
{
cString buffer = cString::sprintf("%s:\t%s", name, Value);
SetText(buffer);
cStatus::MsgOsdCurrentItem(buffer);
}
示例3: SetEntry
bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry)
{
// 0 1 2 3 4 5 6 7 8 9 10
//result = CharacterDatabase.PQuery("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text FROM item_instance WHERE guid = '%u'", guid);
// create item before any checks for store correct guid
// and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
Object::_Create(guid, 0, HIGHGUID_ITEM);
// Set entry, MUST be before proto check
SetEntry(entry);
SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
ItemPrototype const* proto = GetProto();
if (!proto)
return false;
// set owner (not if item is only loaded for gbank/auction/mail
if (owner_guid != 0)
SetOwnerGUID(owner_guid);
bool need_save = false; // need explicit save data at load fixes
SetUInt64Value(ITEM_FIELD_CREATOR, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
SetUInt64Value(ITEM_FIELD_GIFTCREATOR, MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER));
SetCount(fields[2].GetUInt32());
uint32 duration = fields[3].GetUInt32();
SetUInt32Value(ITEM_FIELD_DURATION, duration);
// update duration if need, and remove if not need
if ((proto->Duration == 0) != (duration == 0))
{
SetUInt32Value(ITEM_FIELD_DURATION, abs(proto->Duration));
need_save = true;
}
Tokens tokens(fields[4].GetString(), ' ', MAX_ITEM_PROTO_SPELLS);
if (tokens.size() == MAX_ITEM_PROTO_SPELLS)
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
SetSpellCharges(i, atoi(tokens[i]));
SetUInt32Value(ITEM_FIELD_FLAGS, fields[5].GetUInt32());
// Remove bind flag for items vs NO_BIND set
if (IsSoulBound() && proto->Bonding == NO_BIND)
{
ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND, false);
need_save = true;
}
std::string enchants = fields[6].GetString();
_LoadIntoDataField(enchants.c_str(), ITEM_FIELD_ENCHANTMENT_1_1, MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET);
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, fields[7].GetInt32());
// recalculate suffix factor
if (GetItemRandomPropertyId() < 0)
UpdateItemSuffixFactor();
uint32 durability = fields[8].GetUInt32();
SetUInt32Value(ITEM_FIELD_DURABILITY, durability);
// update max durability (and durability) if need
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, proto->MaxDurability);
if (durability > proto->MaxDurability)
{
SetUInt32Value(ITEM_FIELD_DURABILITY, proto->MaxDurability);
need_save = true;
}
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, fields[9].GetUInt32());
SetText(fields[10].GetString());
if (need_save) // normal item changed state set not work at loading
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_ITEM_INSTANCE_ON_LOAD);
stmt->setUInt32(0, GetUInt32Value(ITEM_FIELD_DURATION));
stmt->setUInt32(1, GetUInt32Value(ITEM_FIELD_FLAGS));
stmt->setUInt32(2, GetUInt32Value(ITEM_FIELD_DURABILITY));
stmt->setUInt32(3, guid);
CharacterDatabase.Execute(stmt);
}
return true;
}
示例4: SetText
bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid)
{
// create item before any checks for store correct guid
// and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
Object::_Create(guidLow, 0, HIGHGUID_ITEM);
if (!LoadValues(fields[0].GetString()))
{
sLog.outError("Item #%d have broken data in `data` field. Can't be loaded.", guidLow);
return false;
}
SetText(fields[1].GetCppString());
bool need_save = false; // need explicit save data at load fixes
// overwrite possible wrong/corrupted guid
ObjectGuid new_item_guid = ObjectGuid(HIGHGUID_ITEM, guidLow);
if (GetGuidValue(OBJECT_FIELD_GUID) != new_item_guid)
{
SetGuidValue(OBJECT_FIELD_GUID, new_item_guid);
need_save = true;
}
ItemPrototype const* proto = GetProto();
if(!proto)
return false;
// update max durability (and durability) if need
if(proto->MaxDurability!= GetUInt32Value(ITEM_FIELD_MAXDURABILITY))
{
SetUInt32Value(ITEM_FIELD_MAXDURABILITY,proto->MaxDurability);
if(GetUInt32Value(ITEM_FIELD_DURABILITY) > proto->MaxDurability)
SetUInt32Value(ITEM_FIELD_DURABILITY,proto->MaxDurability);
need_save = true;
}
// recalculate suffix factor
if(GetItemRandomPropertyId() < 0)
{
if(UpdateItemSuffixFactor())
need_save = true;
}
// Remove bind flag for items vs NO_BIND set
if (IsSoulBound() && proto->Bonding == NO_BIND)
{
ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_BINDED, false);
need_save = true;
}
// update duration if need, and remove if not need
if ((proto->Duration == 0) != (GetUInt32Value(ITEM_FIELD_DURATION) == 0))
{
SetUInt32Value(ITEM_FIELD_DURATION, proto->Duration);
need_save = true;
}
// set correct owner
if (!ownerGuid.IsEmpty() && GetOwnerGuid() != ownerGuid)
{
SetOwnerGuid(ownerGuid);
need_save = true;
}
// Insert to Refundable map
if(GetPlayedtimeField())
{
std::pair< uint64, uint32 > insertpair;
insertpair.first = GetGUID();
insertpair.second = 0;
sObjectMgr.mItemRefundableMap.insert(insertpair);
}
// set correct wrapped state
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))
{
// wrapped item must be wrapper (used version that not stackable)
if (!(proto->Flags & ITEM_FLAG_WRAPPER) || GetMaxStackCount() > 1)
{
RemoveFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED);
need_save = true;
static SqlStatementID delGifts ;
// also cleanup for sure gift table
SqlStatement stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM character_gifts WHERE item_guid = ?");
stmt.PExecute(GetGUIDLow());
}
}
if (need_save) // normal item changed state set not work at loading
{
static SqlStatementID updItem ;
SqlStatement stmt = CharacterDatabase.CreateStatement(updItem, "UPDATE item_instance SET data = ?, owner_guid = ? WHERE guid = ?");
std::ostringstream ss;
//.........这里部分代码省略.........
示例5: SetArea
bool MythUIText::ParseElement(
const QString &filename, QDomElement &element, bool showWarnings)
{
if (element.tagName() == "area")
{
SetArea(parseRect(element));
m_OrigDisplayRect = m_Area;
}
// else if (element.tagName() == "altarea") // Unused, but maybe in future?
// m_AltDisplayRect = parseRect(element);
else if (element.tagName() == "font")
{
QString fontname = getFirstText(element);
MythFontProperties *fp = GetFont(fontname);
if (!fp)
fp = GetGlobalFontMap()->GetFont(fontname);
if (fp)
{
MythFontProperties font = *fp;
int screenHeight = GetMythMainWindow()->GetUIScreenRect().height();
font.Rescale(screenHeight);
int fontStretch = GetMythUI()->GetFontStretch();
font.AdjustStretch(fontStretch);
QString state = element.attribute("state","");
if (!state.isEmpty())
{
m_FontStates.insert(state, font);
}
else
{
m_FontStates.insert("default", font);
*m_Font = m_FontStates["default"];
}
}
}
else if (element.tagName() == "value")
{
if (element.attribute("lang","").isEmpty())
{
m_Message = qApp->translate("ThemeUI",
parseText(element).toUtf8(), NULL,
QCoreApplication::UnicodeUTF8);
}
#if 0
else if (element.attribute("lang","").toLower() ==
gCoreContext->GetLanguageAndVariant())
#else
else if (element.attribute("lang","").toLower() ==
"en_us")
#endif
{
m_Message = parseText(element);
}
#if 0
else if (element.attribute("lang","").toLower() ==
gCoreContext->GetLanguage())
#else
else if (element.attribute("lang","").toLower() ==
"en")
#endif
{
m_Message = parseText(element);
}
m_DefaultMessage = m_Message;
SetText(m_Message);
}
else if (element.tagName() == "template")
示例6: SetFont
void UIStaticText::LoadFromYamlNode(const YamlNode * node, UIYamlLoader * loader)
{
UIControl::LoadFromYamlNode(node, loader);
const YamlNode * fontNode = node->Get("font");
const YamlNode * textNode = node->Get("text");
const YamlNode * multilineNode = node->Get("multiline");
const YamlNode * multilineBySymbolNode = node->Get("multilineBySymbol");
const YamlNode * fittingNode = node->Get("fitting");
const YamlNode * textColorNode = node->Get("textcolor");
const YamlNode * shadowColorNode = node->Get("shadowcolor");
const YamlNode * shadowOffsetNode = node->Get("shadowoffset");
const YamlNode * textAlignNode = node->Get("textalign");
const YamlNode * textColorInheritTypeNode = node->Get("textcolorInheritType");
const YamlNode * shadowColorInheritTypeNode = node->Get("shadowcolorInheritType");
if (fontNode)
{
const String & fontName = fontNode->AsString();
Font * font = loader->GetFontByName(fontName);
SetFont(font);
}
bool multiline = loader->GetBoolFromYamlNode(multilineNode, false);
bool multilineBySymbol = loader->GetBoolFromYamlNode(multilineBySymbolNode, false);
SetMultiline(multiline, multilineBySymbol);
if(fittingNode)
{
SetFittingOption(loader->GetFittingOptionFromYamlNode(fittingNode));
}
if(textColorNode)
{
SetTextColor(textColorNode->AsColor());
}
if(shadowColorNode)
{
SetShadowColor(shadowColorNode->AsColor());
}
if(shadowOffsetNode)
{
SetShadowOffset(shadowOffsetNode->AsVector2());
}
if (textAlignNode)
{
SetTextAlign(loader->GetAlignFromYamlNode(textAlignNode));
}
if (textNode)
{
SetText(LocalizedString(textNode->AsWString()));
}
if (textColorInheritTypeNode)
{
GetTextBackground()->SetColorInheritType((UIControlBackground::eColorInheritType)loader->GetColorInheritTypeFromNode(textColorInheritTypeNode));
}
if (shadowColorInheritTypeNode)
{
GetShadowBackground()->SetColorInheritType((UIControlBackground::eColorInheritType)loader->GetColorInheritTypeFromNode(shadowColorInheritTypeNode));
}
}
示例7: SetText
void MythUITextEdit::Reset()
{
SetText("");
}
示例8: KeyDlgProc
/****************************************************************************
* KeyDlgProc *
* - Redefines keys by processing WM_CHAR's and assigning the key to the *
* selected radiobutton (game key) *
* - Standard dialog window I/O *
****************************************************************************/
MRESULT EXPENTRY KeyDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
int i;
static KEY keyTmp[KEYS];
static SHORT id;
switch (msg) {
case WM_INITDLG:
/* Set the associated text for each of the radio buttons */
for (i=0;i<KEYS;i++) {
keyTmp[i] = prfProfile.keyDEFS[i];
SetText(hwnd, TEXT_LEFT+i, &prfProfile.keyDEFS[i]);
}
/* Check the first radio button and let it set up id */
WinSendDlgItemMsg(hwnd, KEY_LEFT, BM_CLICK, MPFROMSHORT(TRUE), MPVOID);
return (MRESULT) TRUE;
case WM_HELP:
i = IDH_KEYS;
WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
MPFROMP(&i), MPFROMSHORT(HM_RESOURCEID));
return 0;
case WM_COMMAND:
switch (SHORT1FROMMP(mp1)) {
case DID_OK:
for (i=0;i<KEYS;i++)
prfProfile.keyDEFS[i] = keyTmp[i];
case DID_CANCEL:
WinDismissDlg(hwnd, 0);
return 0;
}
return 0;
case WM_CONTROL:
if (SHORT2FROMMP(mp1) == BN_CLICKED) {
switch (SHORT1FROMMP(mp1)) {
case KEY_LEFT:
id = TEXT_LEFT;
break;
case KEY_RIGHT:
id = TEXT_RIGHT;
break;
case KEY_THRUST:
id = TEXT_THRUST;
break;
case KEY_HYPER:
id = TEXT_HYPER;
break;
case KEY_FIRE:
id = TEXT_FIRE;
break;
case KEY_SHIELD:
id = TEXT_SHIELD;
}
WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd,id));
}
return 0;
case WM_CHAR:
if (!(CHARMSG(&msg)->fs & KC_KEYUP)) {
if ((CHARMSG(&msg)->fs & KC_VIRTUALKEY) &&
(CHARMSG(&msg)->vkey != VK_SHIFT) &&
(CHARMSG(&msg)->vkey != VK_CTRL) &&
(CHARMSG(&msg)->vkey != VK_ALT) &&
(CHARMSG(&msg)->vkey != VK_F1) &&
(CHARMSG(&msg)->vkey-1 < MAXVKEY)) {
if (CHARMSG(&msg)->vkey == VK_F3) {
WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_CANCEL, 0),
MPVOID);
return 0;
}
keyTmp[id-TEXT_LEFT].vk = (CHAR) (CHARMSG(&msg)->vkey - 1);
keyTmp[id-TEXT_LEFT].chr = 0;
}
else if ((CHARMSG(&msg)->fs & KC_CHAR) &&
(CHARMSG(&msg)->chr > 32) &&
(CHARMSG(&msg)->chr < 127)) {
keyTmp[id-TEXT_LEFT].vk = 0;
keyTmp[id-TEXT_LEFT].chr = (CHAR) CHARMSG(&msg)->chr;
}
else {
keyTmp[id-TEXT_LEFT].vk = 0;
keyTmp[id-TEXT_LEFT].chr = 0;
}
}
SetText(hwnd, id, &keyTmp[id-TEXT_LEFT]);
return 0;
}
//.........这里部分代码省略.........
示例9: locker
void OPFResource::AutoFixWellFormedErrors()
{
QWriteLocker locker(&GetLock());
QString source = CleanSource::ProcessXML(GetText(),"application/oebps-package+xml");
SetText(source);
}
示例10: SetText
void
TimeConfigPanel::SetLocalTime(RoughTimeDelta utc_offset)
{
SetText(LocalTime,
FormatLocalTimeHHMM((int)CommonInterface::Basic().time, utc_offset));
}
示例11: GetNextItem
void DataListCtrl::OnSave(wxCommandEvent& event)
{
long item = GetNextItem(-1,
wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED);
if (item != -1)
{
wxString name = GetText(item, 1);
if (GetItemText(item) == "Volume")
{
wxFileDialog *fopendlg = new wxFileDialog(
m_frame, "Save Volume Data", "", "",
"Muti-page Tiff file (*.tif, *.tiff)|*.tif;*.tiff|"\
"Single-page Tiff sequence (*.tif)|*.tif;*.tiff|"\
"Nrrd file (*.nrrd)|*.nrrd",
wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
fopendlg->SetExtraControlCreator(CreateExtraControl);
int rval = fopendlg->ShowModal();
if (rval == wxID_OK)
{
wxString filename = fopendlg->GetPath();
VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
if (vr_frame)
{
VolumeData* vd = vr_frame->GetDataManager()->GetVolumeData(name);
if (vd)
{
vd->Save(filename, fopendlg->GetFilterIndex(), false, VRenderFrame::GetCompression());
wxString str = vd->GetPath();
SetText(item, 2, str);
}
}
}
delete fopendlg;
}
else if (GetItemText(item) == "Mesh")
{
wxFileDialog *fopendlg = new wxFileDialog(
m_frame, "Save Mesh Data", "", "",
"OBJ file (*.obj)|*.obj",
wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
int rval = fopendlg->ShowModal();
if (rval == wxID_OK)
{
wxString filename = fopendlg->GetPath();
VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
if(vr_frame)
{
MeshData* md = vr_frame->GetDataManager()->GetMeshData(name);
if (md)
{
md->Save(filename);
wxString str = md->GetPath();
SetText(item, 2, str);
}
}
}
delete fopendlg;
}
else if (GetItemText(item) == "Annotations")
{
wxFileDialog *fopendlg = new wxFileDialog(
m_frame, "Save Annotations", "", "",
"Text file (*.txt)|*.txt",
wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
int rval = fopendlg->ShowModal();
if (rval == wxID_OK)
{
wxString filename = fopendlg->GetPath();
VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
if(vr_frame)
{
Annotations* ann = vr_frame->GetDataManager()->GetAnnotations(name);
if (ann)
{
ann->Save(filename);
wxString str = ann->GetPath();
SetText(item, 2, str);
}
}
}
delete fopendlg;
}
}
}
示例12: SetText
void SetText(const tstring& s) {SetText(s.c_str());}
示例13: switch
bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& message)
{
CGUIDialog::OnMessage(message);
switch ( message.GetMessage() )
{
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
switch (iControl)
{
case CTL_BUTTON_DONE:
OnOK();
break;
case CTL_BUTTON_CANCEL:
Close();
break;
case CTL_BUTTON_SHIFT:
OnShift();
break;
case CTL_BUTTON_CAPS:
OnCapsLock();
break;
case CTL_BUTTON_SYMBOLS:
OnSymbols();
break;
case CTL_BUTTON_LEFT:
MoveCursor( -1);
break;
case CTL_BUTTON_RIGHT:
MoveCursor(1);
break;
case CTL_BUTTON_IP_ADDRESS:
OnIPAddress();
break;
case CTL_BUTTON_CLEAR:
SetText("");
break;
default:
m_lastRemoteKeyClicked = 0;
OnClickButton(iControl);
break;
}
}
break;
case GUI_MSG_SET_TEXT:
SetText(message.GetLabel());
// close the dialog if requested
if (message.GetParam1() > 0)
OnOK();
break;
case GUI_MSG_INPUT_TEXT:
InputText(message.GetLabel());
break;
case GUI_MSG_INPUT_TEXT_EDIT:
InputTextEditing(message.GetLabel(), message.GetParam1(), message.GetParam2());
break;
}
return true;
}
示例14: SetText
void CBSObject::SetWindowText(UINT uiTextResID)
{
SetText(uiTextResID);
}
示例15: StatusToIcon
void TorrentDialog::RefreshList() {
if (!IsWindow()) return;
Feed* feed = Aggregator.Get(FEED_CATEGORY_LINK);
if (!feed) return;
// Hide list to avoid visual defects and gain performance
list_.Hide();
list_.DeleteAllItems();
// Add items
for (auto it = feed->items.begin(); it != feed->items.end(); ++it) {
// Skip item if it was discarded and hidden
if (it->state == FEEDITEM_DISCARDED_HIDDEN)
continue;
wstring title, number, video;
int group = TORRENT_ANIME, icon = StatusToIcon(0);
if (it->category == L"Batch" ||
InStr(it->title, L"Vol.") > -1) {
group = TORRENT_BATCH;
}
if (!IsNumeric(it->episode_data.number)) {
if (it->episode_data.format.empty() ||
IsEpisodeRange(it->episode_data.number)) {
group = TORRENT_BATCH;
} else {
group = TORRENT_OTHER;
}
}
auto anime_item = AnimeDatabase.FindItem(it->episode_data.anime_id);
if (anime_item) {
icon = StatusToIcon(anime_item->GetAiringStatus());
title = anime_item->GetTitle();
} else if (!it->episode_data.title.empty()) {
title = it->episode_data.title;
} else {
group = TORRENT_OTHER;
title = it->title;
}
vector<int> numbers;
SplitEpisodeNumbers(it->episode_data.number, numbers);
number = JoinEpisodeNumbers(numbers);
if (!it->episode_data.version.empty()) {
number += L"v" + it->episode_data.version;
}
video = it->episode_data.video_type;
if (!it->episode_data.resolution.empty()) {
if (!video.empty()) video += L" ";
video += it->episode_data.resolution;
}
int index = list_.InsertItem(it - feed->items.begin(),
group, icon, 0, NULL, title.c_str(),
reinterpret_cast<LPARAM>(&(*it)));
list_.SetItem(index, 1, number.c_str());
list_.SetItem(index, 2, it->episode_data.group.c_str());
list_.SetItem(index, 3, it->episode_data.file_size.c_str());
list_.SetItem(index, 4, video.c_str());
list_.SetItem(index, 5, it->description.c_str());
list_.SetItem(index, 6, it->episode_data.file.c_str());
list_.SetCheckState(index, it->state == FEEDITEM_SELECTED);
}
// Show again
list_.Show();
// Set title
wstring title = L"Torrents";
if (!feed->title.empty()) {
title = feed->title;
} else if (!feed->link.empty()) {
win32::Url url(feed->link);
title += L" (" + url.Host + L")";
}
if (!feed->description.empty()) {
title += L" - " + feed->description;
}
SetText(title.c_str());
}