本文整理汇总了C++中CGUIMessage::SetParam1方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIMessage::SetParam1方法的具体用法?C++ CGUIMessage::SetParam1怎么用?C++ CGUIMessage::SetParam1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIMessage
的用法示例。
在下文中一共展示了CGUIMessage::SetParam1方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMessage
bool CGUIButtonControl::OnMessage(CGUIMessage& message)
{
if (message.GetControlId() == GetID())
{
if (message.GetMessage() == GUI_MSG_LABEL_SET)
{
SetLabel(message.GetLabel());
return true;
}
if (message.GetMessage() == GUI_MSG_LABEL2_SET)
{
SetLabel2(message.GetLabel());
return true;
}
if (message.GetMessage() == GUI_MSG_IS_SELECTED)
{
message.SetParam1(m_bSelected ? 1 : 0);
return true;
}
if (message.GetMessage() == GUI_MSG_SET_SELECTED)
{
if (!m_bSelected)
SetInvalid();
m_bSelected = true;
return true;
}
if (message.GetMessage() == GUI_MSG_SET_DESELECTED)
{
if (m_bSelected)
SetInvalid();
m_bSelected = false;
return true;
}
}
return CGUIControl::OnMessage(message);
}
示例2: OnMessage
bool CGUISelectButtonControl::OnMessage(CGUIMessage& message)
{
if ( message.GetControlId() == GetID() )
{
if (message.GetMessage() == GUI_MSG_LABEL_ADD)
{
if (m_vecItems.size() <= 0)
{
m_iCurrentItem = 0;
m_iDefaultItem = 0;
}
m_vecItems.push_back(message.GetLabel());
return true;
}
else if (message.GetMessage() == GUI_MSG_LABEL_RESET)
{
m_vecItems.erase(m_vecItems.begin(), m_vecItems.end());
m_iCurrentItem = -1;
m_iDefaultItem = -1;
return true;
}
else if (message.GetMessage() == GUI_MSG_ITEM_SELECTED)
{
message.SetParam1(m_iCurrentItem);
if (m_iCurrentItem >= 0 && m_iCurrentItem < (int)m_vecItems.size())
message.SetLabel(m_vecItems[m_iCurrentItem]);
return true;
}
else if (message.GetMessage() == GUI_MSG_ITEM_SELECT)
{
m_iDefaultItem = m_iCurrentItem = message.GetParam1();
return true;
}
}
return CGUIButtonControl::OnMessage(message);
}
示例3: OnMessage
bool CGUIControlGroup::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage() )
{
case GUI_MSG_ITEM_SELECT:
{
if (message.GetControlId() == GetID())
{
m_focusedControl = message.GetParam1();
return true;
}
break;
}
case GUI_MSG_ITEM_SELECTED:
{
if (message.GetControlId() == GetID())
{
message.SetParam1(m_focusedControl);
return true;
}
break;
}
case GUI_MSG_FOCUSED:
{ // a control has been focused
m_focusedControl = message.GetControlId();
SetFocus(true);
// tell our parent thatwe have focus
if (m_parentControl)
m_parentControl->OnMessage(message);
return true;
}
case GUI_MSG_SETFOCUS:
{
// first try our last focused control...
if (!m_defaultAlways && m_focusedControl)
{
CGUIControl *control = GetFirstFocusableControl(m_focusedControl);
if (control)
{
CGUIMessage msg(GUI_MSG_SETFOCUS, GetParentID(), control->GetID());
return control->OnMessage(msg);
}
}
// ok, no previously focused control, try the default control first
if (m_defaultControl)
{
CGUIControl *control = GetFirstFocusableControl(m_defaultControl);
if (control)
{
CGUIMessage msg(GUI_MSG_SETFOCUS, GetParentID(), control->GetID());
return control->OnMessage(msg);
}
}
// no success with the default control, so just find one to focus
CGUIControl *control = GetFirstFocusableControl(0);
if (control)
{
CGUIMessage msg(GUI_MSG_SETFOCUS, GetParentID(), control->GetID());
return control->OnMessage(msg);
}
// unsuccessful
return false;
break;
}
case GUI_MSG_LOSTFOCUS:
{
// set all subcontrols unfocused
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
(*it)->SetFocus(false);
if (!HasID(message.GetParam1()))
{ // we don't have the new id, so unfocus
SetFocus(false);
if (m_parentControl)
m_parentControl->OnMessage(message);
}
return true;
}
break;
case GUI_MSG_PAGE_CHANGE:
case GUI_MSG_REFRESH_THUMBS:
case GUI_MSG_REFRESH_LIST:
case GUI_MSG_WINDOW_RESIZE:
{ // send to all child controls (make sure the target is the control id)
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIMessage msg(message.GetMessage(), message.GetSenderId(), (*it)->GetID(), message.GetParam1());
(*it)->OnMessage(msg);
}
return true;
}
break;
}
bool handled(false);
//not intented for any specific control, send to all childs and our base handler.
if (message.GetControlId() == 0)
{
for (iControls it = m_children.begin();it != m_children.end(); ++it)
{
CGUIControl* control = *it;
handled |= control->OnMessage(message);
//.........这里部分代码省略.........
示例4: OnMessage
bool CGUISpinControl::OnMessage(CGUIMessage& message)
{
if (CGUIControl::OnMessage(message) )
return true;
if (message.GetControlId() == GetID() )
{
switch (message.GetMessage())
{
case GUI_MSG_ITEM_SELECT:
if (SPIN_CONTROL_TYPE_PAGE == m_iType)
{
m_currentItem = message.GetParam1();
return true;
}
SetValue( message.GetParam1());
if (message.GetParam2() == SPIN_BUTTON_DOWN || message.GetParam2() == SPIN_BUTTON_UP)
m_iSelect = message.GetParam2();
return true;
break;
case GUI_MSG_LABEL_RESET:
if (SPIN_CONTROL_TYPE_PAGE == m_iType)
{
m_itemsPerPage = message.GetParam1();
m_numItems = message.GetParam2();
return true;
}
{
Clear();
return true;
}
break;
case GUI_MSG_SHOWRANGE:
if (message.GetParam1() )
m_bShowRange = true;
else
m_bShowRange = false;
break;
case GUI_MSG_SET_LABELS:
if (message.GetPointer())
{
const vector< pair<string, int> > *labels = (const vector< pair<string, int> > *)message.GetPointer();
Clear();
for (vector< pair<string, int> >::const_iterator i = labels->begin(); i != labels->end(); ++i)
AddLabel(i->first, i->second);
SetValue( message.GetParam1());
}
break;
case GUI_MSG_LABEL_ADD:
{
AddLabel(message.GetLabel(), message.GetParam1());
return true;
}
break;
case GUI_MSG_ITEM_SELECTED:
{
message.SetParam1( GetValue() );
message.SetParam2(m_iSelect);
if (m_iType == SPIN_CONTROL_TYPE_TEXT)
{
if ( m_iValue >= 0 && m_iValue < (int)m_vecLabels.size() )
message.SetLabel( m_vecLabels[m_iValue]);
}
return true;
}
case GUI_MSG_PAGE_UP:
if (CanMoveUp())
MoveUp();
return true;
case GUI_MSG_PAGE_DOWN:
if (CanMoveDown())
MoveDown();
return true;
case GUI_MSG_MOVE_OFFSET:
{
int count = (int)message.GetParam1();
while (count < 0)
{
MoveUp();
count++;
}
while (count > 0)
{
MoveDown();
count--;
}
return true;
}
}
}
return false;
//.........这里部分代码省略.........