本文整理汇总了C++中CInterfaceElement类的典型用法代码示例。如果您正苦于以下问题:C++ CInterfaceElement类的具体用法?C++ CInterfaceElement怎么用?C++ CInterfaceElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CInterfaceElement类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
string sValue = getParam(Params,"value");
string sTarget = getParam(Params,"target");
if (sTarget.empty()) return;
if (sTarget.rfind(':') == string::npos)
{
if (pCaller == NULL) return;
sTarget = pCaller->getId() + ":" + sTarget;
}
else
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
string elt = sTarget.substr(0,sTarget.rfind(':'));
CInterfaceElement *pIE;
if (pCaller != NULL)
pIE = pIM->getElementFromId(pCaller->getId(), elt);
else
pIE = pIM->getElementFromId(elt);
if (pIE == NULL) return;
sTarget = pIE->getId() + ":" + sTarget.substr(sTarget.rfind(':')+1,sTarget.size());
}
CInterfaceExprValue evValue;
if (CInterfaceExpr::eval(sValue, evValue, NULL))
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (evValue.toInteger())
pIM->addServerString (sTarget, (uint32)evValue.getInteger());
}
}
示例2: getParentSize
void CInterfaceElement::getSizeParent( std::string &id ) const
{
CInterfaceElement *p = getParentSize();
// If there's no parent set then the size parent is the parent
if( p == NULL )
{
id = "parent";
return;
}
// If the size parent is the same as the group parent, then the size parent is the parent ofc
if( p == getParent() )
{
id = "parent";
return;
}
// If the size parent is in the parent group, use the short Id
if( p->isInGroup( getParent() ) )
{
id = p->getShortId();
return;
}
// Otherwise use the full Id
id = p->getId();
}
示例3: getAlbum
// ***************************************************************************
void CEncyclopediaManager::updateThema(uint32 nAlbumName, const CEncyMsgThema &t)
{
CEncyMsgAlbum *pA = getAlbum(nAlbumName);
nlassert(pA != NULL);
CEncyMsgThema *pT = pA->getThema(t.Name);
// Thema not found add it !
if (pT == NULL)
{
uint32 nBack = (uint32)pA->Themas.size();
pA->Themas.push_back(CEncyMsgThema());
pT = &pA->Themas[nBack];
// If we are not initializing so we must open the encyclopedia on the new thema
if ( ! _Initializing )
{
_AlbumNameSelected = nAlbumName;
_ThemaNameSelected = t.Name;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CInterfaceElement *pContainer = dynamic_cast<CInterfaceElement*>(pIM->getElementFromId(CONT_ENCY));
if (pContainer != NULL)
pContainer->setActive(true);
}
}
nlassert(pT != NULL);
*pT = t;
}
示例4: getParent
void CInterfaceElement::getPosParent( std::string &id ) const
{
// If there's no pos parent set, then the parent group is the pos parent
if( getParentPos() == NULL )
{
id = "parent";
return;
}
// If pos parent and parent are the same then ofc the parent group is the pos parent...
CInterfaceElement *p = getParent();
if( getParentPos() == p )
{
id = "parent";
return;
}
// If parent is in the same group, use the short id
p = getParentPos();
if( p->isInGroup( getParent() ) )
{
id = p->getShortId();
return;
}
// Otherwise use the full id
id = p->getId();
}
示例5: invalidateContent
// ***************************************************************************
void CInterfaceElement::invalidateContent()
{
CInterfaceElement *elm = this;
while (elm)
{
// Call back
elm->onInvalidateContent();
// Get the parent
elm = elm->getParent();
}
}
示例6: getParentContainer
// ------------------------------------------------------------------------------------------------
CInterfaceGroup* CInterfaceElement::getParentContainer()
{
CInterfaceElement *parent = this;
while (parent)
{
CInterfaceGroup *gc = dynamic_cast< CInterfaceGroup* >( parent );
if( ( gc != NULL ) && gc->isGroupContainer() )
return gc;
parent = parent->getParent();
}
return NULL;
}
示例7: rebuildAlbumPage
// ***************************************************************************
void CEncyclopediaManager::rebuildAlbumPage(uint32 albumName)
{
uint32 i;
CEncyMsgAlbum *pAlbum = NULL;
// Select the right album
for (i = 0; i < _Albums.size(); ++i)
{
if (_Albums[i].Name == albumName)
{
_AlbumNameSelected = _Albums[i].Name;
pAlbum = &_Albums[i];
break;
}
}
if (pAlbum == NULL)
return;
// Update the right page
CInterfaceManager *pIM = CInterfaceManager::getInstance();
// Hide and show good group
CInterfaceElement *pIE = pIM->getElementFromId(PAGE_ENCY_ALBUM);
nlassert(pIE != NULL);
pIE->setActive(true);
pIE = pIM->getElementFromId(PAGE_ENCY_HELP);
pIE->setActive(false);
pIE = pIM->getElementFromId(PAGE_ENCY_THEMA);
pIE->setActive(false);
// Setup title
CViewTextID *pVT = dynamic_cast<CViewTextID*>(pIM->getElementFromId(PAGE_ENCY_ALBUM ":title"));
nlassert(pVT != NULL);
pVT->setTextId(pAlbum->Name);
// Setup brick reward
pIM->getDbProp("UI:VARIABLES:ENCY:ALBUMBRICK:SHEET")->setValue32(pAlbum->RewardBrick);
CViewText *pRBVT = dynamic_cast<CViewText*>(pIM->getElementFromId(PAGE_ENCY_ALBUM ":reward:desc"));
if (pRBVT != NULL)
{
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
const ucstring desc(pSMC->getSBrickLocalizedDescription(CSheetId(pAlbum->RewardBrick)));
pRBVT->setText(desc);
}
}
示例8: onPropertyChanged
void CPropBrowserCtrl::onPropertyChanged( QtProperty *prop )
{
QString propName = prop->propertyName();
QString propValue = prop->valueText();
// for some reason booleans cannot be extracted from a QtProperty :(
if( propValue.isEmpty() )
{
QtVariantProperty *p = propertyMgr->variantProperty( prop );
if( p != NULL )
propValue = p->value().toString();
}
CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement );
if( e == NULL )
return;
e->setProperty( propName.toUtf8().constData(), propValue.toUtf8().constData() );
}
示例9:
// ------------------------------------------------------------------------------------------------
void CInterfaceElement::relativeSInt32Read (CInterfaceProperty &rIP, const string &prop, const char *val,
const string &defVal)
{
if (val == NULL)
{
rIP.readSInt32 (defVal.c_str(), _Id+":"+prop);
}
else
{
if ( isdigit(*val) || *val=='-')
{
rIP.readSInt32 (val, _Id+":"+prop);
return;
}
sint32 decal = 0;
if (val[0] == ':')
decal = 1;
if (NLGUI::CDBManager::getInstance()->getDbProp(val+decal, false) != NULL)
{
rIP.readSInt32 (val+decal, _Id+":"+prop);
return;
}
else
{
string sTmp;
CInterfaceElement *pIEL = this;
while (pIEL != NULL)
{
sTmp = pIEL->getId()+":"+string(val+decal);
if (NLGUI::CDBManager::getInstance()->getDbProp(sTmp, false) != NULL)
{
rIP.readSInt32 (sTmp.c_str(), _Id+":"+prop);
return;
}
pIEL = pIEL->getParent();
}
rIP.readSInt32 (val+decal, _Id+":"+prop);
}
}
}
示例10: disconnect
void CPropBrowserCtrl::onSelectionChanged( std::string &id )
{
if( browser == NULL )
return;
disconnect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ),
this, SLOT( onPropertyChanged( QtProperty* ) ) );
browser->clear();
CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( id );
if( e == NULL )
return;
currentElement = id;
std::string n = e->getClassName();
setupProperties( n, e );
connect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ),
this, SLOT( onPropertyChanged( QtProperty* ) ) );
}
示例11: nlassert
// ****************************************************************************
void CHugeListObs::updateUIItemPage(uint index)
{
nlassert((uint) _Category < ListTypeCount); // must call setListType
CInterfaceManager *im = CInterfaceManager::getInstance();
//
std::string dbPath; // db path for the current item list
TItemVect *items = &_ItemsPages;
CDBCtrlSheet::TSheetCategory *itemCategory = &_ItemCategory;
CDBGroupListSheetText *listSheet;
CCDBNodeLeaf *itemListCategoryLeaf = NULL;
switch (_Category)
{
case Trading:
{
if (BotChatPageAll->Trade->getBuyOnly())
{
dbPath = DB_LOCAL_BRANCH_FOR_ITEM_FOR_MONEY ":";
listSheet = dynamic_cast<CDBGroupListSheetText *>(im->getElementFromId(UI_LIST_OF_ITEMS_FOR_MONEY_BUY_ONLY));
}
else
{
dbPath = DB_LOCAL_BRANCH_FOR_ITEM_FOR_MONEY ":";
listSheet = dynamic_cast<CDBGroupListSheetText *>(im->getElementFromId(UI_LIST_OF_ITEMS_FOR_MONEY));
}
if (!listSheet) return;
itemListCategoryLeaf = im->getDbProp("UI:TEMP:TYPE_OF_ITEMS_TO_BUY", false);
}
break;
case ItemForMissions:
{
dbPath = DB_LOCAL_BRANCH_FOR_ITEM_FOR_MISSION ":";
listSheet = dynamic_cast<CDBGroupListSheetText *>(im->getElementFromId(UI_LIST_OF_ITEMS_FOR_MISSION));
if (!listSheet) return;
itemListCategoryLeaf = im->getDbProp("UI:TEMP:TYPE_OF_ITEMS_FOR_MISSION", false);
if (!itemListCategoryLeaf) return;
// display the group for mission items
CInterfaceElement *elm = im->getElementFromId(UI_GROUP_OF_ITEMS_FOR_MISSION);
if (elm) elm->setActive(true);
}
break;
case Ascensor:
{
dbPath = DB_LOCAL_BRANCH_FOR_ASCENSOR ":";
listSheet = dynamic_cast<CDBGroupListSheetText *>(im->getElementFromId(UI_LIST_OF_ITEMS_FOR_ASCENSOR));
if (!listSheet) return;
// display the group for mission items
CInterfaceElement *elm = im->getElementFromId(UI_GROUP_OF_ITEMS_FOR_ASCENSOR);
if (elm) elm->setActive(true);
}
break;
case Missions:
{
dbPath = DB_LOCAL_BRANCH_FOR_MISSIONS ":";
listSheet = dynamic_cast<CDBGroupListSheetText *>(im->getElementFromId(UI_LIST_OF_MISSIONS));
if (!listSheet) return;
// display the group for mission items
CInterfaceElement *elm = im->getElementFromId(UI_GROUP_OF_MISSIONS);
if (elm) elm->setActive(true);
}
break;
default:
nlassert(0); // Provide code for initializing
break;
}
// Copy item into the big local db
for(uint k = 0; k < TRADE_PAGE_NUM_ITEMS; ++k)
{
CCDBNodeLeaf *leaf;
const CItem &currItem = (*items)[index].Items[k];
// get branch for the item
switch(_Category)
{
case Trading:
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":QUALITY", false);
if (leaf) leaf->setValue32(currItem.Quality);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":SLOT_TYPE", false);
if (leaf) leaf->setValue32(currItem.SlotType);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":SHEET", false);
if (leaf) leaf->setValue32(currItem.SheetIDOrSkill);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":PRICE", false);
if (leaf) leaf->setValue32(currItem.Price);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":WEIGHT", false);
if (leaf) leaf->setValue32(currItem.Weight);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":NAMEID", false);
if (leaf) leaf->setValue32(currItem.NameId);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":USER_COLOR", false);
if (leaf) leaf->setValue32(currItem.UserColor);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":ENCHANT", false);
if (leaf) leaf->setValue32(currItem.Enchant);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":RM_CLASS_TYPE", false);
if (leaf) leaf->setValue32(currItem.RMClassType);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":RM_FABER_STAT_TYPE", false);
if (leaf) leaf->setValue32(currItem.RMFaberStatType);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":PREREQUISIT_VALID", false);
if (leaf) leaf->setValue32(currItem.PrerequisitValid);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":INFO_VERSION", false);
if (leaf) leaf->setValue32(currItem.InfoVersion);
leaf = im->getDbProp(dbPath + toString(k + index * TRADE_PAGE_NUM_ITEMS) + ":QUANTITY", false);
if (leaf) leaf->setValue32(currItem.Quantity);
//.........这里部分代码省略.........
示例12: rebuildThemaPage
// ***************************************************************************
void CEncyclopediaManager::rebuildThemaPage(uint32 themaName)
{
uint32 i;
CEncyMsgThema *pThema = NULL;
// Select the right album
for (i = 0; i < _Albums.size(); ++i)
{
pThema = _Albums[i].getThema(themaName);
if (pThema != NULL)
{
_AlbumNameSelected = _Albums[i].Name;
break;
}
}
if (pThema == NULL)
return;
// Update the right page
CInterfaceManager *pIM = CInterfaceManager::getInstance();
// Hide and show good group
CInterfaceElement *pIE = pIM->getElementFromId(PAGE_ENCY_ALBUM);
nlassert(pIE != NULL);
pIE->setActive(false);
pIE = pIM->getElementFromId(PAGE_ENCY_HELP);
pIE->setActive(false);
pIE = pIM->getElementFromId(PAGE_ENCY_THEMA);
pIE->setActive(true);
// Setup title
CViewTextID *pVT = dynamic_cast<CViewTextID*>(pIM->getElementFromId(PAGE_ENCY_THEMA ":title"));
nlassert(pVT != NULL);
pVT->setTextId(pThema->Name);
// Setup rewards
pVT = dynamic_cast<CViewTextID*>(pIM->getElementFromId(PAGE_ENCY_THEMA ":reward_text:desc"));
nlassert(pVT != NULL);
pVT->setTextId(pThema->RewardText);
// Setup brick reward
pIM->getDbProp("UI:VARIABLES:ENCY:REWARDBRICK:SHEET")->setValue32(pThema->RewardSheet);
CViewText *pRBVT = dynamic_cast<CViewText*>(pIM->getElementFromId(PAGE_ENCY_THEMA ":reward:desc"));
nlassert(pRBVT != NULL);
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
CEntitySheet *pES = SheetMngr.get(CSheetId(pThema->RewardSheet));
if (pES != NULL)
{
if (pES->type() == CEntitySheet::ITEM)
{
const ucstring desc(pSMC->getItemLocalizedDescription(CSheetId(pThema->RewardSheet)));
pRBVT->setText(desc);
}
else if (pES->type() == CEntitySheet::SBRICK)
{
const ucstring desc(pSMC->getSBrickLocalizedDescription(CSheetId(pThema->RewardSheet)));
pRBVT->setText(desc);
}
else if (pES->type() == CEntitySheet::SPHRASE)
{
const ucstring desc(pSMC->getSPhraseLocalizedDescription(CSheetId(pThema->RewardSheet)));
pRBVT->setText(desc);
}
}
// Setup the total number of steps
uint32 nNbSteps = pThema->NbTask - 1; // 0th is the rite
pIM->getDbProp("UI:VARIABLES:ENCY:STEPS")->setValue32(nNbSteps);
// Count number of tasks done
uint32 nNbTaskDone = 0;
for (i = 0; i < pThema->NbTask; ++i)
if (pThema->getTaskState((uint8)i) == 2) // 2 == finished
++nNbTaskDone;
pIM->getDbProp("UI:VARIABLES:ENCY:DONE")->setValue32(nNbTaskDone);
// setup rite & tasks
for (i = 0; i < pThema->NbTask; ++i)
{
string sTmp;
if (i == 0)
sTmp = PAGE_ENCY_THEMA ":todo2:rite";
else
sTmp = PAGE_ENCY_THEMA ":todo:task" + toString(i);
// setup task description
CViewTextID *pText = dynamic_cast<CViewTextID*>(pIM->getElementFromId(sTmp+":desc"));
nlassert(pText != NULL);
pText->setTextId(pThema->TaskName[i]);
// setup task NPC name
CStringPostProcessNPCRemoveTitle *pSPPRT = new CStringPostProcessNPCRemoveTitle;
pIM->addServerID (sTmp+":npc:uc_hardtext", pThema->TaskNPCName[i], pSPPRT);
// If the task is not known gray it
if (pThema->getTaskState((uint8)i) == 0)
pText->setAlpha(80);
else
pText->setAlpha(160);
//.........这里部分代码省略.........
示例13: closeAllInterfaces
// ***************************************************************************
void CGuildManager::update()
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
// *** Need to rebuild the guild data?
if (_NeedRebuild)
{
_NeedUpdate = true;
_NeedRebuild = false;
// Rebuild transfert the database to the local structure
// Guild stuff
uint32 oldName = _Guild.NameID;
_Guild.NameID = pIM->getDbProp("SERVER:GUILD:NAME")->getValue32();
_Guild.Name = "";
_InGuild = (_Guild.NameID != 0);
if (!_InGuild)
closeAllInterfaces();
_Guild.Icon = pIM->getDbProp("SERVER:GUILD:ICON")->getValue64();
_Guild.QuitGuildAvailable = true;
// Guild Members
if(_NeedRebuildMembers)
{
_NeedUpdateMembers = true;
_NeedRebuildMembers = false;
_GuildMembers.clear();
for (uint32 i = 0; i < MAX_GUILD_MEMBER; ++i)
{
sint32 name = pIM->getDbProp("SERVER:GUILD:MEMBERS:"+toString(i)+":NAME")->getValue32();
if (name != 0)
{
SGuildMember gm;
gm.NameID = name;
gm.Index = i;
gm.Grade = (EGSPD::CGuildGrade::TGuildGrade)(pIM->getDbProp("SERVER:GUILD:MEMBERS:"+toString(i)+":GRADE")->getValue32());
gm.Online = (TCharConnectionState)(pIM->getDbProp("SERVER:GUILD:MEMBERS:"+toString(i)+":ONLINE")->getValue32());
gm.EnterDate = pIM->getDbProp("SERVER:GUILD:MEMBERS:"+toString(i)+":ENTER_DATE")->getValue32();
_GuildMembers.push_back(gm);
}
}
}
// Does the player are newcomer ?
// Boris 01/09/2006 : removed : now the guild interface is open if
// is was active before OR if the EGS ask it to the client
bool playerNewToTheGuild = _NewToTheGuild &&(oldName != _Guild.NameID) && _InGuild;
if (playerNewToTheGuild)
{
// reset the flag
_NewToTheGuild = false;
// Don't pop the guild window in ring mode.
// NB nico : this test should not be necessary, as the guild infos should be filled during the init of the db
// However, there are situation where this db info is filled after init (should only happen at guild creation time ...)
// Maybe an EGS bug ?
if (R2::getEditor().getMode() == R2::CEditor::NotInitialized)
{
CInterfaceElement *pElt;
// Open the guild info if we are not in the init phase
if (!IngameDbMngr.initInProgress())
{
pElt = pIM->getElementFromId(WIN_GUILD);
if (pElt != NULL)
pElt->setActive(true);
}
// Browse the forum
pElt = pIM->getElementFromId(WIN_GUILD_FORUM":content:html");
if (pElt != NULL)
{
CGroupHTML *html = dynamic_cast<CGroupHTML*>(pElt);
if (html)
html->browse("home");
}
}
}
}
// *** Need to update Names?
if (_NeedUpdate)
{
bool bAllValid = true;
// Update wait until all the name of members, name of the guild and description are valid
if (!pSMC->getString (_Guild.NameID, _Guild.Name)) bAllValid = false;
for (uint i = 0; i < _GuildMembers.size(); ++i)
{
if (!pSMC->getString (_GuildMembers[i].NameID, _GuildMembers[i].Name)) bAllValid = false;
else _GuildMembers[i].Name = CEntityCL::removeTitleAndShardFromName(_GuildMembers[i].Name);
}
// If all is valid no more need update and if guild is opened update the interface
if (bAllValid)
{
// Search for UserEntity to find our own grade
//.........这里部分代码省略.........
示例14:
// ***************************************************************************
void CInterfaceConfig::CDesktopImage::toCurrentDesktop()
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
COnLoadConfigVisitor onLoadVisitor;
pIM->visit(&onLoadVisitor); // send 'onLoad' msg to every element
// uint32 nCount = 0;
for(uint k = 0; k < GCImages.size(); ++k)
{
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId(GCImages[k].Id));
if (pGC != NULL)
GCImages[k].setTo(pGC);
}
// serial extra data from the stream
NLMISC::CMemStream &f = ExtraDatas;
if (!f.isReading())
{
f.invert();
}
f.resetPtrTable();
f.seek(0, NLMISC::IStream::begin);
f.seek(0, NLMISC::IStream::end);
if (f.getPos() == 0) return;
f.seek(0, NLMISC::IStream::begin);
// Load TopWindow config
if(Version>=1)
{
string topWindowName;
f.serial(topWindowName);
if(!topWindowName.empty())
{
CInterfaceGroup *window= dynamic_cast<CInterfaceGroup*>(pIM->getElementFromId(topWindowName));
if(window && window->getActive())
pIM->setTopWindow(window);
}
}
uint32 numElemWithConfig;
f.serial(numElemWithConfig);
for(uint k = 0; k < numElemWithConfig; ++k)
{
std::string elemID;
f.serial(elemID);
uint32 chunkSize;
f.serial(chunkSize);
uint startPos = f.getPos();
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceElement *elem = im->getElementFromId(elemID);
if (!elem)
{
nlwarning("Element %s not found while loading config, skipping datas", elemID.c_str());
f.seek(chunkSize, NLMISC::IStream::current);
}
else
{
try
{
elem->serialConfig(f);
}
catch (const NLMISC::ENewerStream &)
{
nlwarning("Element %s config in stream are too recent to be read by the application, config ignored", elemID.c_str());
f.seek(startPos + chunkSize, NLMISC::IStream::begin);
}
}
}
}