当前位置: 首页>>代码示例>>C++>>正文


C++ CGUIControl::GetID方法代码示例

本文整理汇总了C++中CGUIControl::GetID方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIControl::GetID方法的具体用法?C++ CGUIControl::GetID怎么用?C++ CGUIControl::GetID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGUIControl的用法示例。


在下文中一共展示了CGUIControl::GetID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadAdditionalTags

void CGUIMediaWindow::LoadAdditionalTags(TiXmlElement *root)
{
  CGUIWindow::LoadAdditionalTags(root);
  // configure our view control
  m_viewControl.Reset();
  m_viewControl.SetParentWindow(GetID());
  TiXmlElement *element = root->FirstChildElement("views");
  if (element && element->FirstChild())
  { // format is <views>50,29,51,95</views>
    CStdString allViews = element->FirstChild()->Value();
    CStdStringArray views;
    StringUtils::SplitString(allViews, ",", views);
    for (unsigned int i = 0; i < views.size(); i++)
    {
      int controlID = atol(views[i].c_str());
      CGUIControl *control = (CGUIControl *)GetControl(controlID);
      if (control && control->IsContainer())
        m_viewControl.AddView(control);
    }
  }
  else
  { // backward compatibility
    vector<CGUIControl *> controls;
    GetContainers(controls);
    for (ciControls it = controls.begin(); it != controls.end(); it++)
    {
      CGUIControl *control = *it;
      if (control->GetID() >= CONTROL_VIEW_START && control->GetID() <= CONTROL_VIEW_END)
        m_viewControl.AddView(control);
    }
  }
  m_viewControl.SetViewControlID(CONTROL_BTNVIEWASICONS);
}
开发者ID:SirTomselon,项目名称:xbmc,代码行数:33,代码来源:GUIMediaWindow.cpp

示例2: AddControl

void CGUIControlGroupList::AddControl(CGUIControl *control)
{
  // NOTE: We override control navigation here, but we don't override the <onleft> etc. builtins
  //       if specified.
  if (control)
  { // set the navigation of items so that they form a list
    if (m_orientation == VERTICAL)
    {
      DWORD upID = GetControlIdUp();
      DWORD downID = GetControlIdDown();
      if (m_children.size())
      {
        CGUIControl *top = m_children[0];
        if (downID == GetID())
          downID = top->GetID();
        if (upID == GetID())
          top->SetNavigation(control->GetID(), top->GetControlIdDown(), GetControlIdLeft(), GetControlIdRight());
        CGUIControl *prev = m_children[m_children.size() - 1];
        upID = prev->GetID();
        prev->SetNavigation(prev->GetControlIdUp(), control->GetID(), GetControlIdLeft(), GetControlIdRight());
      }
      control->SetNavigation(upID, downID, GetControlIdLeft(), GetControlIdRight());
    }
    else
    {

      DWORD leftID = GetControlIdLeft();
      DWORD rightID = GetControlIdRight();
      if (m_children.size())
      {
        CGUIControl *left = m_children[0];
        if (rightID == GetID())
          rightID = left->GetID();
        if (leftID == GetID())
          left->SetNavigation(GetControlIdUp(), GetControlIdDown(), control->GetID(), left->GetControlIdRight());
        CGUIControl *prev = m_children[m_children.size() - 1];
        leftID = prev->GetID();
        prev->SetNavigation(GetControlIdUp(), GetControlIdDown(), prev->GetControlIdLeft(), control->GetID());
      }
      control->SetNavigation(GetControlIdUp(), GetControlIdDown(), leftID, rightID);
    }
    // old versions of the grouplist used to set the positions of all controls
    // directly.  The new version (with <usecontrolcoords>true</usecontrolcoords>)
    // allows offsets to be set via the posx, posy coordinates.
    if (!m_useControlPositions)
      control->SetPosition(0,0);
    CGUIControlGroup::AddControl(control);
  }
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:49,代码来源:GUIControlGroupList.cpp

示例3: OnWindowLoaded

void CGUIMediaWindow::OnWindowLoaded()
{
  CGUIWindow::OnWindowLoaded();
  m_viewControl.Reset();
  m_viewControl.SetParentWindow(GetID());
  vector<CGUIControl *> controls;
  GetContainers(controls);
  for (ciControls it = controls.begin(); it != controls.end(); it++)
  {
    CGUIControl *control = *it;
    if (control->GetID() >= CONTROL_VIEW_START && control->GetID() <= CONTROL_VIEW_END)
      m_viewControl.AddView(control);
  }
  m_viewControl.SetViewControlID(CONTROL_BTNVIEWASICONS);
  SetupShares();
}
开发者ID:jimmyswimmy,项目名称:plex,代码行数:16,代码来源:GUIMediaWindow.cpp

示例4: OnAction

bool CGUIDialogKeyboardGeneric::OnAction(const CAction &action)
{
  bool handled = true;
  if (action.GetID() == (KEY_VKEY | XBMCVK_BACK))
    Backspace();
  else if (action.GetID() == ACTION_ENTER || (m_isKeyboardNavigationMode && action.GetID() == ACTION_SELECT_ITEM))
    OnOK();
  else if (action.GetID() == ACTION_SHIFT)
    OnShift();
  else if (action.GetID() == ACTION_SYMBOLS)
    OnSymbols();
  // don't handle move left/right and select in the edit control
  else if (!m_isKeyboardNavigationMode &&
           (action.GetID() == ACTION_MOVE_LEFT ||
           action.GetID() == ACTION_MOVE_RIGHT ||
           action.GetID() == ACTION_SELECT_ITEM))
    handled = false;
  else
  {
    handled = false;
    wchar_t unicode = action.GetUnicode();
    if (unicode)
    {
      std::wstring wch = L"";
      wch.insert(wch.begin(), unicode);
      std::string ch;
      g_charsetConverter.wToUTF8(wch, ch);
      handled = CodingCharacter(ch);
      if (!handled)
      {
        // send action to edit control
        CGUIControl *edit = GetControl(CTL_EDIT);
        if (edit)
          handled = edit->OnAction(action);
        if (!handled && action.GetID() >= KEY_VKEY && action.GetID() < KEY_ASCII)
        {
          BYTE b = action.GetID() & 0xFF;
          if (b == XBMCVK_TAB)
          {
            // Toggle left/right key mode
            m_isKeyboardNavigationMode = !m_isKeyboardNavigationMode;
            if (m_isKeyboardNavigationMode)
            {
              m_previouslyFocusedButton = GetFocusedControlID();
              SET_CONTROL_FOCUS(edit->GetID(), 0);
            }
            else
              SET_CONTROL_FOCUS(m_previouslyFocusedButton, 0);
            handled = true;
          }
        }
      }
    }
  }

  if (!handled) // unhandled by us - let's see if the baseclass wants it
    handled = CGUIDialog::OnAction(action);

  return handled;
}
开发者ID:niekez,项目名称:xbmc,代码行数:60,代码来源:GUIDialogKeyboardGeneric.cpp

示例5: OnAction

bool CGUIWindowSettings::OnAction(const CAction &action)
{
  if (action.id == ACTION_PREVIOUS_MENU)
  {
    g_windowManager.PreviousWindow();
    return true;
  }
  else if (action.id == ACTION_PARENT_DIR)
  {
    g_windowManager.PreviousWindow();
    return true;
  }
  else if (action.id == ACTION_SELECT_ITEM)
  {
    CGUIControl *focusedControl = GetFocusedControl();
    if (focusedControl && focusedControl->IsContainer())
    {
      m_iSelectedControl = focusedControl->GetID();

      CGUIBaseContainer* container  = (CGUIBaseContainer*)focusedControl;
      m_iSelectedItem = container->GetSelectedItem();
    }
  }

  return CGUIWindow::OnAction(action);
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:26,代码来源:GUIWindowSettings.cpp

示例6: GetFocusedControlID

int CGUIControlGroup::GetFocusedControlID() const
{
  if (m_focusedControl) return m_focusedControl;
  CGUIControl *control = GetFocusedControl();
  if (control) return control->GetID();
  return 0;
}
开发者ID:evilhamster,项目名称:xbmc,代码行数:7,代码来源:GUIControlGroup.cpp

示例7: OnAction

bool CGUIDialogAddonSettings::OnAction(const CAction& action)
{
  if (action.GetID() == ACTION_DELETE_ITEM)
  {
    CGUIControl* pControl = GetFocusedControl();
    if (pControl)
    {
      int iControl = pControl->GetID();
      int controlId = CONTROL_START_SETTING;
      const TiXmlElement* setting = GetFirstSetting();
      UpdateFromControls();
      while (setting)
      {
        if (controlId == iControl)
        {
          const char* id = setting->Attribute("id");
          const char* value = setting->Attribute("default");
          if (id && value)
            m_settings[id] = value;
          CreateControls();
          CGUIMessage msg(GUI_MSG_SETFOCUS,GetID(),iControl);
          OnMessage(msg);
          return true;
        }
        setting = setting->NextSiblingElement("setting");
        controlId++;
      }
    }
  }
  return CGUIDialogBoxBase::OnAction(action);
}
开发者ID:meijin007,项目名称:xbmc,代码行数:31,代码来源:GUIDialogAddonSettings.cpp

示例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();
}
开发者ID:2BReality,项目名称:xbmc,代码行数:21,代码来源:GUIListGroup.cpp

示例9: OnAction

bool CGUIDialogKeyboardGeneric::OnAction(const CAction &action)
{
    bool handled = true;
    if (action.GetID() == ACTION_ENTER || (m_isKeyboardNavigationMode && action.GetID() == ACTION_SELECT_ITEM))
        OnOK();
    else if (action.GetID() == ACTION_SHIFT)
        OnShift();
    else if (action.GetID() == ACTION_SYMBOLS)
        OnSymbols();
    // don't handle move left/right and select in the edit control
    else if (!m_isKeyboardNavigationMode &&
             (action.GetID() == ACTION_MOVE_LEFT ||
              action.GetID() == ACTION_MOVE_RIGHT ||
              action.GetID() == ACTION_SELECT_ITEM))
        handled = false;
    else
    {
        handled = false;
        // send action to edit control
        CGUIControl *edit = GetControl(CTL_EDIT);
        if (edit)
            handled = edit->OnAction(action);
        if (!handled && action.GetID() >= KEY_VKEY && action.GetID() < KEY_ASCII)
        {
            BYTE b = action.GetID() & 0xFF;
            if (b == XBMCVK_TAB)
            {
                // Toggle left/right key mode
                m_isKeyboardNavigationMode = !m_isKeyboardNavigationMode;
                if (m_isKeyboardNavigationMode)
                {
                    m_previouslyFocusedButton = GetFocusedControlID();
                    SET_CONTROL_FOCUS(edit->GetID(), 0);
                }
                else
                    SET_CONTROL_FOCUS(m_previouslyFocusedButton, 0);
                handled = true;
            }
        }
    }

    if (!handled) // unhandled by us - let's see if the baseclass wants it
        handled = CGUIDialog::OnAction(action);

    return handled;
}
开发者ID:rlansi,项目名称:Kodi_dualaudio,代码行数:46,代码来源:GUIDialogKeyboardGeneric.cpp

示例10:

// in the case of id == 0, we don't match id
CGUIControl *CGUIControlGroup::GetFirstFocusableControl(int id)
{
  if (!CanFocus()) return NULL;
  if (id && id == (int) GetID()) return this; // we're focusable and they want us
  for (iControls it = m_children.begin(); it != m_children.end(); ++it)
  {
    CGUIControl* pControl = *it;
    if (pControl->IsGroup())
    {
      CGUIControlGroup *group = (CGUIControlGroup *)pControl;
      CGUIControl *control = group->GetFirstFocusableControl(id);
      if (control) return control;
    }
    if ((!id || (int) pControl->GetID() == id) && pControl->CanFocus())
      return pControl;
  }
  return NULL;
}
开发者ID:evilhamster,项目名称:xbmc,代码行数:19,代码来源:GUIControlGroup.cpp

示例11: RemoveControl

// Note: This routine doesn't delete the control.  It just removes it from the control list
bool CGUIControlGroup::RemoveControl(int id)
{
  for (iControls it = m_children.begin(); it != m_children.end(); ++it)
  {
    CGUIControl *control = *it;
    if (control->IsGroup())
    {
      CGUIControlGroup *group = (CGUIControlGroup *)control;
      if (group->RemoveControl(id))
        return true;
    }
    if ((int) control->GetID() == id)
    {
      m_children.erase(it);
      return true;
    }
  }
  return false;
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:20,代码来源:GUIControlGroup.cpp

示例12: ControlGroupHasFocus

// returns true if the control group with id groupID has controlID as
// its focused control
bool CGUIWindow::ControlGroupHasFocus(int groupID, int controlID)
{
  // 1.  Run through and get control with groupID (assume unique)
  // 2.  Get it's selected item.
  CGUIControl *group = GetFirstFocusableControl(groupID);
  if (!group) group = (CGUIControl *)GetControl(groupID);

  if (group && group->IsGroup())
  {
    if (controlID == 0)
    { // just want to know if the group is focused
      return group->HasFocus();
    }
    else
    {
      CGUIMessage message(GUI_MSG_ITEM_SELECTED, GetID(), group->GetID());
      group->OnMessage(message);
      return (controlID == (int) message.GetParam1());
    }
  }
  return false;
}
开发者ID:,项目名称:,代码行数:24,代码来源:

示例13: 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());
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:36,代码来源:GUIViewControl.cpp

示例14: 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());
}
开发者ID:KenJusticeJr,项目名称:xbmc,代码行数:64,代码来源:GUIViewControl.cpp

示例15: OnMessage

bool CGUIWindow::OnMessage(CGUIMessage& message)
{
  switch ( message.GetMessage() )
  {
  case GUI_MSG_WINDOW_INIT:
    {
      CLog::Log(LOGDEBUG, "------ Window Init (%s) ------", GetProperty("xmlfile").c_str());
      if (m_dynamicResourceAlloc || !m_bAllocated) AllocResources();
      OnInitWindow();
      return true;
    }
    break;

  case GUI_MSG_WINDOW_DEINIT:
    {
      CLog::Log(LOGDEBUG, "------ Window Deinit (%s) ------", GetProperty("xmlfile").c_str());
      OnDeinitWindow(message.GetParam1());
      // now free the window
      if (m_dynamicResourceAlloc) FreeResources();
      return true;
    }
    break;

  case GUI_MSG_CLICKED:
    {
      // a specific control was clicked
      CLICK_EVENT clickEvent = m_mapClickEvents[ message.GetSenderId() ];

      // determine if there are any handlers for this event
      if (clickEvent.HasAHandler())
      {
        // fire the message to all handlers
        clickEvent.Fire(message);
      }
      break;
    }

  case GUI_MSG_SELCHANGED:
    {
      // a selection within a specific control has changed
      SELECTED_EVENT selectedEvent = m_mapSelectedEvents[ message.GetSenderId() ];

      // determine if there are any handlers for this event
      if (selectedEvent.HasAHandler())
      {
        // fire the message to all handlers
        selectedEvent.Fire(message);
      }
      break;
    }
  case GUI_MSG_FOCUSED:
    { // a control has been focused
      if (HasID(message.GetSenderId()))
      {
        m_focusedControl = message.GetControlId();
        return true;
      }
      break;
    }
  case GUI_MSG_LOSTFOCUS:
    {
      // nothing to do at the window level when we lose focus
      return true;
    }
  case GUI_MSG_MOVE:
    {
      if (HasID(message.GetSenderId()))
        return OnMove(message.GetControlId(), message.GetParam1());
      break;
    }
  case GUI_MSG_SETFOCUS:
    {
//      CLog::Log(LOGDEBUG,"set focus to control:%i window:%i (%i)\n", message.GetControlId(),message.GetSenderId(), GetID());
      if ( message.GetControlId() )
      {
        // first unfocus the current control
        CGUIControl *control = GetFocusedControl();
        if (control)
        {
          CGUIMessage msgLostFocus(GUI_MSG_LOSTFOCUS, GetID(), control->GetID(), message.GetControlId());
          control->OnMessage(msgLostFocus);
        }

        // get the control to focus
        CGUIControl* pFocusedControl = GetFirstFocusableControl(message.GetControlId());
        if (!pFocusedControl) pFocusedControl = (CGUIControl *)GetControl(message.GetControlId());

        // and focus it
        if (pFocusedControl)
          return pFocusedControl->OnMessage(message);
      }
      return true;
    }
    break;
  case GUI_MSG_EXCLUSIVE_MOUSE:
    {
      m_exclusiveMouseControl = message.GetSenderId();
      return true;
    }
    break;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的CGUIControl::GetID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。