本文整理汇总了C++中BaseSettingControlPtr::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseSettingControlPtr::IsValid方法的具体用法?C++ BaseSettingControlPtr::IsValid怎么用?C++ BaseSettingControlPtr::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseSettingControlPtr
的用法示例。
在下文中一共展示了BaseSettingControlPtr::IsValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMessage
bool CGUIDialogSettingsBase::OnMessage(CGUIMessage &message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
m_delayedSetting.reset();
if (message.GetParam1() != WINDOW_INVALID)
{ // coming to this window first time (ie not returning back from some other window)
// so we reset our section and control states
m_iCategory = 0;
ResetControlStates();
}
if (AllowResettingSettings())
{
m_resetSetting = new CSettingAction(SETTINGS_RESET_SETTING_ID);
m_resetSetting->SetLabel(10041);
m_resetSetting->SetHelp(10045);
m_resetSetting->SetControl(CreateControl("button"));
}
m_dummyCategory = new CSettingCategory(SETTINGS_EMPTY_CATEGORY_ID);
m_dummyCategory->SetLabel(10046);
m_dummyCategory->SetHelp(10047);
break;
}
case GUI_MSG_WINDOW_DEINIT:
{
// cancel any delayed changes
if (m_delayedSetting != NULL)
{
m_delayedTimer.Stop();
CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), m_delayedSetting->GetID());
OnMessage(message);
}
CGUIDialog::OnMessage(message);
FreeControls();
return true;
}
case GUI_MSG_FOCUSED:
{
CGUIDialog::OnMessage(message);
int focusedControl = GetFocusedControlID();
// cancel any delayed changes
if (m_delayedSetting != NULL && m_delayedSetting->GetID() != focusedControl)
{
m_delayedTimer.Stop();
CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), m_delayedSetting->GetID(), 1); // param1 = 1 for "reset the control if it's invalid"
g_windowManager.SendThreadMessage(message, GetID());
}
// update the value of the previous setting (in case it was invalid)
else if (m_iSetting >= CONTROL_SETTINGS_START_CONTROL && m_iSetting < (int)(CONTROL_SETTINGS_START_CONTROL + m_settingControls.size()))
{
BaseSettingControlPtr control = GetSettingControl(m_iSetting);
if (control != NULL && control->GetSetting() != NULL && !control->IsValid())
{
CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), m_iSetting, 1); // param1 = 1 for "reset the control if it's invalid"
g_windowManager.SendThreadMessage(message, GetID());
}
}
CVariant description;
// check if we have changed the category and need to create new setting controls
if (focusedControl >= CONTROL_SETTINGS_START_BUTTONS && focusedControl < (int)(CONTROL_SETTINGS_START_BUTTONS + m_categories.size()))
{
int categoryIndex = focusedControl - CONTROL_SETTINGS_START_BUTTONS;
const CSettingCategory* category = m_categories.at(categoryIndex);
if (categoryIndex != m_iCategory)
{
if (!category->CanAccess())
{
// unable to go to this category - focus the previous one
SET_CONTROL_FOCUS(CONTROL_SETTINGS_START_BUTTONS + m_iCategory, 0);
return false;
}
m_iCategory = categoryIndex;
CreateSettings();
}
description = category->GetHelp();
}
else if (focusedControl >= CONTROL_SETTINGS_START_CONTROL && focusedControl < (int)(CONTROL_SETTINGS_START_CONTROL + m_settingControls.size()))
{
m_iSetting = focusedControl;
CSetting *setting = GetSettingControl(focusedControl)->GetSetting();
if (setting != NULL)
description = setting->GetHelp();
}
// set the description of the currently focused category/setting
if (description.isInteger() ||
(description.isString() && !description.empty()))
SetDescription(description);
//.........这里部分代码省略.........