本文整理汇总了C++中CGUIControl::SetVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIControl::SetVisible方法的具体用法?C++ CGUIControl::SetVisible怎么用?C++ CGUIControl::SetVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIControl
的用法示例。
在下文中一共展示了CGUIControl::SetVisible方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetPointer
void CGUIWindowPointer::SetPointer(int pointer)
{
if (m_pointer == pointer) return;
// set the new pointer visible
CGUIControl *pControl = GetControl(pointer);
if (pControl)
{
pControl->SetVisible(true);
// disable the old pointer
pControl = GetControl(m_pointer);
if (pControl) pControl->SetVisible(false);
// set pointer to the new one
m_pointer = pointer;
}
}
示例2: AddSetting
void CGUIDialogVisualisationSettings::AddSetting(VisSetting &setting, float width, int iControlID)
{
CGUIControl *pControl = NULL;
if (setting.type == VisSetting::CHECK)
{
pControl = new CGUIRadioButtonControl(*m_pOriginalRadioButton);
if (!pControl) return ;
((CGUIRadioButtonControl *)pControl)->SetLabel(setting.name);
pControl->SetWidth(width);
((CGUIRadioButtonControl *)pControl)->SetSelected(setting.current == 1);
}
else if (setting.type == VisSetting::SPIN && setting.entry.size() > 0)
{
pControl = new CGUISpinControlEx(*m_pOriginalSpin);
if (!pControl) return ;
pControl->SetWidth(width);
((CGUISpinControlEx *)pControl)->SetText(setting.name);
pControl->SetWidth(width);
for (unsigned int i = 0; i < setting.entry.size(); i++)
((CGUISpinControlEx *)pControl)->AddLabel(setting.entry[i], i);
((CGUISpinControlEx *)pControl)->SetValue(setting.current);
}
if (!pControl) return;
pControl->SetID(iControlID);
pControl->SetVisible(true);
CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CONTROL_GROUP_LIST);
if (group)
{
pControl->AllocResources();
group->AddControl(pControl);
}
else
delete pControl;
}
示例3: Update
void CGUIControlBaseSetting::Update()
{
CGUIControl *control = GetControl();
if (control == NULL)
return;
control->SetEnabled(IsEnabled());
control->SetVisible(m_pSetting->IsVisible());
}
示例4: OnWindowLoaded
void CGUIWindowPointer::OnWindowLoaded()
{ // set all our pointer images invisible
for (iControls i = m_children.begin();i != m_children.end(); ++i)
{
CGUIControl* pControl = *i;
pControl->SetVisible(false);
}
CGUIWindow::OnWindowLoaded();
DynamicResourceAlloc(false);
m_pointer = 0;
m_renderOrder = RENDER_ORDER_WINDOW_POINTER;
}
示例5: OnInitWindow
void CGUIDialogContextMenu::OnInitWindow()
{ // disable the template button control
CGUIControl *pControl = (CGUIControl *)GetControl(BUTTON_TEMPLATE);
if (pControl)
{
pControl->SetVisible(false);
}
m_iClickedButton = -1;
// set initial control focus
m_lastControlID = BUTTON_TEMPLATE + 1;
CGUIDialog::OnInitWindow();
}
示例6: Update
void CGUIControlBaseSetting::Update(bool updateDisplayOnly /* = false */)
{
if (updateDisplayOnly)
return;
CGUIControl *control = GetControl();
if (control == NULL)
return;
control->SetEnabled(IsEnabled());
if (m_pSetting)
control->SetVisible(m_pSetting->IsVisible());
SetValid(true);
}
示例7: NextControl
void CGUIWindowSettingsScreenCalibration::NextControl()
{ // set the old control invisible and not focused, and choose the next control
CGUIControl *pControl = GetControl(m_iControl);
if (pControl)
{
pControl->SetVisible(false);
pControl->SetFocus(false);
}
// switch to the next control
m_iControl++;
if (m_iControl > CONTROL_PIXEL_RATIO)
m_iControl = CONTROL_TOP_LEFT;
// enable the new control
EnableControl(m_iControl);
}
示例8: EnlargeHeight
void CGUIListGroup::EnlargeHeight(float difference)
{
// Alters the width of the controls that have an ID of 1
for (iControls it = m_children.begin(); it != m_children.end(); it++)
{
CGUIControl *child = *it;
if (child->GetID() >= 1 && child->GetID() <= 14)
{
if (child->GetID() == 1) // label
{
child->SetHeight(child->GetHeight() + difference);
child->SetVisible(child->GetHeight() > 10); ///
}
else
{
child->SetHeight(child->GetHeight() + difference);
}
}
}
SetInvalid();
}
示例9: SelectVisibleView
void CGUIViewControl::SelectVisibleView(int iViewIndex, CGUIControl *previousView, bool focusToVisibleView)
{
m_currentView = iViewIndex;
CGUIControl *pNewView = m_visibleViews[m_currentView];
// make only current control visible...
for (ciViews view = m_allViews.begin(); view != m_allViews.end(); view++)
(*view)->SetVisible(false);
pNewView->SetVisible(true);
if (focusToVisibleView)
{
// if requested -> set focus to the new view
CGUIMessage msg(GUI_MSG_SETFOCUS, m_parentWindow, pNewView->GetID(), 0);
g_windowManager.SendMessage(msg);
}
if (pNewView == previousView)
return; // no need to actually update anything (other than visibility above)
// CLog::Log(LOGDEBUG,"SetCurrentView: Oldview: %i, Newview :%i", m_currentView, viewMode);
int item = -1;
if (previousView)
{ // have an old view - let's clear it out and hide it.
item = GetSelectedItem(previousView);
CGUIMessage msg(GUI_MSG_LABEL_RESET, m_parentWindow, previousView->GetID());
previousView->OnMessage(msg);
}
// Update it with the contents
UpdateContents(pNewView, item, false);
// Update our view control
UpdateViewAsControl(((CGUIBaseContainer *)pNewView)->GetLabel());
}
示例10: SetCurrentView
void CGUIViewControl::SetCurrentView(int viewMode, bool bRefresh /* = false */)
{
// grab the previous control
CGUIControl *previousView = NULL;
if (m_currentView >= 0 && m_currentView < (int)m_visibleViews.size())
previousView = m_visibleViews[m_currentView];
UpdateViewVisibility();
// viewMode is of the form TYPE << 16 | ID
VIEW_TYPE type = (VIEW_TYPE)(viewMode >> 16);
int id = viewMode & 0xffff;
// first find a view that matches this view, if possible...
int newView = GetView(type, id);
if (newView < 0) // no suitable view that matches both id and type, so try just type
newView = GetView(type, 0);
if (newView < 0 && type == VIEW_TYPE_BIG_ICON) // try icon view if they want big icon
newView = GetView(VIEW_TYPE_ICON, 0);
if (newView < 0 && type == VIEW_TYPE_BIG_INFO)
newView = GetView(VIEW_TYPE_INFO, 0);
if (newView < 0) // try a list view
newView = GetView(VIEW_TYPE_LIST, 0);
if (newView < 0) // try anything!
newView = GetView(VIEW_TYPE_NONE, 0);
if (newView < 0)
return;
m_currentView = newView;
CGUIControl *pNewView = m_visibleViews[m_currentView];
// make only current control visible...
for (ciViews view = m_allViews.begin(); view != m_allViews.end(); ++view)
(*view)->SetVisible(false);
pNewView->SetVisible(true);
if (!bRefresh && pNewView == previousView)
return; // no need to actually update anything (other than visibility above)
// CLog::Log(LOGDEBUG,"SetCurrentView: Oldview: %i, Newview :%i", m_currentView, viewMode);
bool hasFocus(false);
int item = -1;
if (previousView)
{ // have an old view - let's clear it out and hide it.
hasFocus = previousView->HasFocus();
item = GetSelectedItem(previousView);
CGUIMessage msg(GUI_MSG_LABEL_RESET, m_parentWindow, previousView->GetID());
previousView->OnMessage(msg);
}
// Update it with the contents
UpdateContents(pNewView, item);
// and focus if necessary
if (hasFocus)
{
CGUIMessage msg(GUI_MSG_SETFOCUS, m_parentWindow, pNewView->GetID(), 0);
g_windowManager.SendMessage(msg, m_parentWindow);
}
UpdateViewAsControl(((IGUIContainer *)pNewView)->GetLabel());
}
示例11: CreateControls
void CGUIDialogPluginSettings::CreateControls()
{
CGUISpinControlEx *pOriginalSpin = (CGUISpinControlEx*)GetControl(CONTROL_DEFAULT_SPIN);
CGUIRadioButtonControl *pOriginalRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_DEFAULT_RADIOBUTTON);
CGUIButtonControl *pOriginalButton = (CGUIButtonControl *)GetControl(CONTROL_DEFAULT_BUTTON);
CGUIImage *pOriginalImage = (CGUIImage *)GetControl(CONTROL_DEFAULT_SEPARATOR);
CGUILabelControl *pOriginalLabel = (CGUILabelControl *)GetControl(CONTROL_DEFAULT_LABEL_SEPARATOR);
if (!pOriginalSpin || !pOriginalRadioButton || !pOriginalButton || !pOriginalImage)
return;
pOriginalSpin->SetVisible(false);
pOriginalRadioButton->SetVisible(false);
pOriginalButton->SetVisible(false);
pOriginalImage->SetVisible(false);
if (pOriginalLabel)
pOriginalLabel->SetVisible(false);
// clear the category group
CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CONTROL_AREA);
if (!group)
return;
// set our dialog heading
SET_CONTROL_LABEL(CONTROL_HEADING_LABEL, m_strHeading);
// Create our base path, used for type "fileenum" settings
CStdString basepath = "Q:\\plugins\\";
CUtil::AddFileToFolder(basepath, m_url.GetHostName(), basepath);
CUtil::AddFileToFolder(basepath, m_url.GetFileName(), basepath);
CGUIControl* pControl = NULL;
int controlId = CONTROL_START_CONTROL;
TiXmlElement *setting = m_settings.GetPluginRoot()->FirstChildElement("setting");
while (setting)
{
const char *type = setting->Attribute("type");
const char *option = setting->Attribute("option");
const char *id = setting->Attribute("id");
CStdString values;
if (setting->Attribute("values"))
values = setting->Attribute("values");
CStdString lvalues;
if (setting->Attribute("lvalues"))
lvalues = setting->Attribute("lvalues");
CStdString entries;
if (setting->Attribute("entries"))
entries = setting->Attribute("entries");
CStdString label;
if (setting->Attribute("label") && atoi(setting->Attribute("label")) > 0)
label.Format("$LOCALIZE[%s]", setting->Attribute("label"));
else
label = setting->Attribute("label");
if (type)
{
if (strcmpi(type, "text") == 0 || strcmpi(type, "ipaddress") == 0 ||
strcmpi(type, "integer") == 0 || strcmpi(type, "video") == 0 ||
strcmpi(type, "music") == 0 || strcmpi(type, "pictures") == 0 ||
strcmpi(type, "folder") == 0 || strcmpi(type, "programs") == 0 ||
strcmpi(type, "files") == 0 || strcmpi(type, "action") == 0)
{
pControl = new CGUIButtonControl(*pOriginalButton);
if (!pControl) return;
((CGUIButtonControl *)pControl)->SettingsCategorySetTextAlign(XBFONT_CENTER_Y);
((CGUIButtonControl *)pControl)->SetLabel(label);
if (id)
((CGUIButtonControl *)pControl)->SetLabel2(m_settings.Get(id));
if (option && strcmpi(option, "hidden") == 0)
((CGUIButtonControl *)pControl)->SetHidden(true);
}
else if (strcmpi(type, "bool") == 0)
{
pControl = new CGUIRadioButtonControl(*pOriginalRadioButton);
if (!pControl) return;
((CGUIRadioButtonControl *)pControl)->SetLabel(label);
((CGUIRadioButtonControl *)pControl)->SetSelected(m_settings.Get(id) == "true");
}
else if (strcmpi(type, "enum") == 0 || strcmpi(type, "labelenum") == 0)
{
vector<CStdString> valuesVec;
vector<CStdString> entryVec;
pControl = new CGUISpinControlEx(*pOriginalSpin);
if (!pControl) return;
((CGUISpinControlEx *)pControl)->SetText(label);
if (!lvalues.IsEmpty())
CUtil::Tokenize(lvalues, valuesVec, "|");
else
CUtil::Tokenize(values, valuesVec, "|");
if (!entries.IsEmpty())
CUtil::Tokenize(entries, entryVec, "|");
for (unsigned int i = 0; i < valuesVec.size(); i++)
{
int iAdd = i;
if (entryVec.size() > i)
iAdd = atoi(entryVec[i]);
if (!lvalues.IsEmpty())
//.........这里部分代码省略.........
示例12: AddSetting
void CGUIDialogSettings::AddSetting(SettingInfo &setting, float width, int iControlID)
{
CGUIControl *pControl = NULL;
if (setting.type == SettingInfo::BUTTON_DIALOG && m_pOriginalSettingsButton)
{
pControl = new CGUIButtonControl(*m_pOriginalSettingsButton);
if (!pControl) return ;
((CGUIButtonControl *)pControl)->SetLabel(setting.name);
pControl->SetWidth(width);
if (setting.data) ((CGUIButtonControl *)pControl)->SetLabel2(*(CStdString *)setting.data);
}
else if (setting.type == SettingInfo::BUTTON && m_pOriginalSettingsButton)
{
pControl = new CGUIButtonControl(*m_pOriginalSettingsButton);
if (!pControl) return ;
((CGUIButtonControl *)pControl)->SetLabel(setting.name);
if (setting.formatFunction)
((CGUIButtonControl *)pControl)->SetLabel2(setting.formatFunction(*(float *)setting.data, setting.interval));
pControl->SetWidth(width);
}
else if (setting.type == SettingInfo::EDIT && m_pOriginalEdit)
{
pControl = new CGUIEditControl(*m_pOriginalEdit);
if (!pControl) return ;
((CGUIEditControl *)pControl)->SetLabel(setting.name);
pControl->SetWidth(width);
if (setting.data) ((CGUIEditControl *)pControl)->SetLabel2(*(CStdString *)setting.data);
}
else if (setting.type == SettingInfo::EDIT_NUM && m_pOriginalEditNum)
{
pControl = new CGUIEditControl(*m_pOriginalEditNum);
if (!pControl) return ;
((CGUIEditControl *)pControl)->SetLabel(setting.name);
pControl->SetWidth(width);
((CGUIEditControl *)pControl)->SetInputType(CGUIEditControl::INPUT_TYPE_NUMBER, 0);
if (setting.data) {
CStdString strIndex;
strIndex.Format("%i", *(int *)setting.data);
((CGUIEditControl *)pControl)->SetLabel2(strIndex);
}
}
else if (setting.type == SettingInfo::SEPARATOR && m_pOriginalSeparator)
{
pControl = new CGUIImage(*m_pOriginalSeparator);
if (!pControl) return ;
pControl->SetWidth(width);
}
else if (setting.type == SettingInfo::CHECK || setting.type == SettingInfo::CHECK_UCHAR)
{
if (!m_pOriginalRadioButton) return;
pControl = new CGUIRadioButtonControl(*m_pOriginalRadioButton);
if (!pControl) return ;
((CGUIRadioButtonControl *)pControl)->SetLabel(setting.name);
pControl->SetWidth(width);
if (setting.data) ((CGUIRadioButtonControl *)pControl)->SetSelected(*(bool *)setting.data == 1);
}
else if (setting.type == SettingInfo::SPIN && setting.entry.size() > 0 && m_pOriginalSpin)
{
pControl = new CGUISpinControlEx(*m_pOriginalSpin);
if (!pControl) return ;
pControl->SetWidth(width);
((CGUISpinControlEx *)pControl)->SetText(setting.name);
pControl->SetWidth(width);
for (unsigned int i = 0; i < setting.entry.size(); i++)
((CGUISpinControlEx *)pControl)->AddLabel(setting.entry[i].second, setting.entry[i].first);
if (setting.data) ((CGUISpinControlEx *)pControl)->SetValue(*(int *)setting.data);
}
else if (setting.type == SettingInfo::SLIDER)
{
if (!m_pOriginalSlider) return;
pControl = new CGUISettingsSliderControl(*m_pOriginalSlider);
if (!pControl) return ;
pControl->SetWidth(width);
((CGUISettingsSliderControl *)pControl)->SetText(setting.name);
if (setting.formatFunction)
((CGUISettingsSliderControl *)pControl)->SetTextValue(setting.formatFunction(*(float *)setting.data, setting.interval));
((CGUISettingsSliderControl *)pControl)->SetType(SPIN_CONTROL_TYPE_FLOAT);
((CGUISettingsSliderControl *)pControl)->SetFloatRange(setting.min, setting.max);
((CGUISettingsSliderControl *)pControl)->SetFloatInterval(setting.interval);
if (setting.data) ((CGUISettingsSliderControl *)pControl)->SetFloatValue(*(float *)setting.data);
}
if (!pControl) return;
pControl->SetID(iControlID);
pControl->SetVisible(true);
pControl->SetEnabled(setting.enabled);
CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CONTROL_GROUP_LIST);
if (group)
{
pControl->AllocResources();
group->AddControl(pControl);
}
else
delete pControl;
}
示例13: CreateControls
void CGUIDialogAddonSettings::CreateControls()
{
FreeControls();
CGUISpinControlEx *pOriginalSpin = dynamic_cast<CGUISpinControlEx*>(GetControl(CONTROL_DEFAULT_SPIN));
CGUIRadioButtonControl *pOriginalRadioButton = dynamic_cast<CGUIRadioButtonControl *>(GetControl(CONTROL_DEFAULT_RADIOBUTTON));
CGUIButtonControl *pOriginalButton = dynamic_cast<CGUIButtonControl *>(GetControl(CONTROL_DEFAULT_BUTTON));
CGUIImage *pOriginalImage = dynamic_cast<CGUIImage *>(GetControl(CONTROL_DEFAULT_SEPARATOR));
CGUILabelControl *pOriginalLabel = dynamic_cast<CGUILabelControl *>(GetControl(CONTROL_DEFAULT_LABEL_SEPARATOR));
CGUISettingsSliderControl *pOriginalSlider = dynamic_cast<CGUISettingsSliderControl *>(GetControl(CONTROL_DEFAULT_SLIDER));
if (!m_addon || !pOriginalSpin || !pOriginalRadioButton || !pOriginalButton || !pOriginalImage
|| !pOriginalLabel || !pOriginalSlider)
return;
pOriginalSpin->SetVisible(false);
pOriginalRadioButton->SetVisible(false);
pOriginalButton->SetVisible(false);
pOriginalImage->SetVisible(false);
pOriginalLabel->SetVisible(false);
pOriginalSlider->SetVisible(false);
CGUIControlGroupList *group = dynamic_cast<CGUIControlGroupList *>(GetControl(CONTROL_SETTINGS_AREA));
if (!group)
return;
// set our dialog heading
SET_CONTROL_LABEL(CONTROL_HEADING_LABEL, m_strHeading);
CGUIControl* pControl = NULL;
int controlId = CONTROL_START_SETTING;
const TiXmlElement *setting = GetFirstSetting();
while (setting)
{
const std::string type = XMLUtils::GetAttribute(setting, "type");
const std::string id = XMLUtils::GetAttribute(setting, "id");
const std::string values = XMLUtils::GetAttribute(setting, "values");
const std::string lvalues = XMLUtils::GetAttribute(setting, "lvalues");
const std::string entries = XMLUtils::GetAttribute(setting, "entries");
const std::string defaultVal = XMLUtils::GetAttribute(setting, "default");
const std::string subsetting = XMLUtils::GetAttribute(setting, "subsetting");
const std::string label = GetString(setting->Attribute("label"), subsetting == "true");
bool bSort = XMLUtils::GetAttribute(setting, "sort") == "yes";
if (!type.empty())
{
bool isAddonSetting = false;
if (type == "text" || type == "ipaddress"
|| type == "number" || type == "video"
|| type == "audio" || type == "image"
|| type == "folder" || type == "executable"
|| type == "file" || type == "action"
|| type == "date" || type == "time"
|| type == "select" || (isAddonSetting = type == "addon"))
{
pControl = new CGUIButtonControl(*pOriginalButton);
if (!pControl) return;
((CGUIButtonControl *)pControl)->SetLabel(label);
if (!id.empty())
{
std::string value = m_settings[id];
m_buttonValues[id] = value;
// get any option to test for hidden
const std::string option = XMLUtils::GetAttribute(setting, "option");
if (option == "urlencoded")
value = CURL::Decode(value);
else if (option == "hidden")
{
std::string hiddenText;
hiddenText.append(value.size(), L'*');
((CGUIButtonControl *)pControl)->SetLabel2(hiddenText);
}
else
{
if (isAddonSetting)
((CGUIButtonControl *)pControl)->SetLabel2(GetAddonNames(value));
else if (type == "select" && !lvalues.empty())
{
vector<string> valuesVec = StringUtils::Split(lvalues, '|');
int selected = atoi(value.c_str());
if (selected >= 0 && selected < (int)valuesVec.size())
{
std::string label = m_addon->GetString(atoi(valuesVec[selected].c_str()));
if (label.empty())
label = g_localizeStrings.Get(atoi(valuesVec[selected].c_str()));
((CGUIButtonControl *)pControl)->SetLabel2(label);
}
}
else
((CGUIButtonControl *)pControl)->SetLabel2(value);
}
}
else
((CGUIButtonControl *)pControl)->SetLabel2(defaultVal);
}
else if (type == "bool" && !id.empty())
{
pControl = new CGUIRadioButtonControl(*pOriginalRadioButton);
if (!pControl) return;
((CGUIRadioButtonControl *)pControl)->SetLabel(label);
//.........这里部分代码省略.........