本文整理汇总了C++中CSetting::GetHelp方法的典型用法代码示例。如果您正苦于以下问题:C++ CSetting::GetHelp方法的具体用法?C++ CSetting::GetHelp怎么用?C++ CSetting::GetHelp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSetting
的用法示例。
在下文中一共展示了CSetting::GetHelp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMessage
bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
m_delayedSetting.reset();
if (message.GetParam1() != WINDOW_INVALID && !m_returningFromSkinLoad)
{ // 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();
}
m_iSection = (int)message.GetParam2() - (int)CGUIWindow::GetID();
CGUIWindow::OnMessage(message);
m_returningFromSkinLoad = false;
return true;
}
case GUI_MSG_WINDOW_DEINIT:
{
// cancel any delayed changes
if (m_delayedSetting != NULL)
{
m_delayedTimer.Stop();
CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID());
OnMessage(message);
}
CGUIWindow::OnMessage(message);
FreeControls();
return true;
}
case GUI_MSG_FOCUSED:
{
CGUIWindow::OnMessage(message);
if (!m_returningFromSkinLoad)
{
int focusedControl = GetFocusedControlID();
// cancel any delayed changes if the focused control has changed
if (m_delayedSetting != NULL && m_delayedSetting->GetID() != focusedControl)
{
m_delayedTimer.Stop();
CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID(), 1); // param1 = 1 for "reset the control if it's invalid"
g_windowManager.SendThreadMessage(message, GetID());
}
// check if we have changed the category and need to create new setting controls
if (focusedControl >= CONTROL_START_BUTTONS && focusedControl < (int)(CONTROL_START_BUTTONS + m_categories.size()))
{
int categoryIndex = focusedControl - CONTROL_START_BUTTONS;
if (categoryIndex != m_iCategory)
{
if (!m_categories[categoryIndex]->CanAccess())
{
// unable to go to this category - focus the previous one
SET_CONTROL_FOCUS(CONTROL_START_BUTTONS + m_iCategory, 0);
return false;
}
m_iCategory = categoryIndex;
CreateSettings();
}
}
else if (focusedControl >= CONTROL_START_CONTROL && focusedControl < (int)(CONTROL_START_CONTROL + m_settingControls.size()))
{
CSetting *setting = GetSettingControl(focusedControl)->GetSetting();
if (setting != NULL)
SetDescription(setting->GetHelp());
}
}
return true;
}
case GUI_MSG_CLICKED:
{
BaseSettingControlPtr control = GetSettingControl(message.GetSenderId());
if (control != NULL)
OnClick(control);
break;
}
case GUI_MSG_LOAD_SKIN:
{
if (IsActive())
m_returningFromSkinLoad = true;
break;
}
case GUI_MSG_UPDATE_ITEM:
{
if (m_delayedSetting != NULL)
{
// first get the delayed setting and reset its member variable
// to avoid handling the delayed setting twice in case the OnClick()
// performed later causes the window to be deinitialized (e.g. when
//.........这里部分代码省略.........
示例2: 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);
//.........这里部分代码省略.........
示例3: OnAction
bool CGUIWindowSettingsCategory::OnAction(const CAction &action)
{
switch (action.GetID())
{
case ACTION_SETTINGS_RESET:
{
if (CGUIDialogYesNo::ShowAndGetInput(10041, 0, 10042, 0))
{
for(vector<BaseSettingControlPtr>::iterator it = m_settingControls.begin(); it != m_settingControls.end(); it++)
{
CSetting *setting = (*it)->GetSetting();
if (setting != NULL)
setting->Reset();
}
}
return true;
}
case ACTION_SETTINGS_LEVEL_CHANGE:
{
CViewStateSettings::Get().CycleSettingLevel();
CSettings::Get().Save();
// try to keep the current position
std::string oldCategory;
if (m_iCategory >= 0 && m_iCategory < (int)m_categories.size())
oldCategory = m_categories[m_iCategory]->GetId();
SET_CONTROL_LABEL(CONTRL_BTN_LEVELS, 10036 + (int)CViewStateSettings::Get().GetSettingLevel());
// only re-create the categories, the settings will be created later
SetupControls(false);
m_iCategory = 0;
// try to find the category that was previously selected
if (!oldCategory.empty())
{
for (int i = 0; i < (int)m_categories.size(); i++)
{
if (m_categories[i]->GetId() == oldCategory)
{
m_iCategory = i;
break;
}
}
}
CreateSettings();
return true;
}
case ACTION_SHOW_INFO:
{
int label = -1;
int help = -1;
int focusedControl = GetFocusedControlID();
// check if we are focusing a category
if (focusedControl >= CONTROL_START_BUTTONS && focusedControl < (int)(CONTROL_START_BUTTONS + m_categories.size()))
{
CSettingCategory *category = m_categories[focusedControl - CONTROL_START_BUTTONS];
label = category->GetLabel();
help = category->GetHelp();
}
else if (focusedControl >= CONTROL_START_CONTROL && focusedControl < (int)(CONTROL_START_CONTROL + m_settingControls.size()))
{
CSetting *setting = GetSettingControl(focusedControl)->GetSetting();
if (setting != NULL)
{
label = setting->GetLabel();
help = setting->GetHelp();
}
}
else
break;
if (help >= 0)
{
CGUIDialogTextViewer *dialog = (CGUIDialogTextViewer*)g_windowManager.GetWindow(WINDOW_DIALOG_TEXT_VIEWER);
if (dialog != NULL)
{
if (label < 0)
label = 10043; // "Help"
dialog->SetHeading(g_localizeStrings.Get(label));
dialog->SetText(g_localizeStrings.Get(help));
dialog->DoModal();
}
}
else
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(10043), g_localizeStrings.Get(10044), 2000U);
return true;
}
default:
break;
}
return CGUIWindow::OnAction(action);
}