PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/xbmc/dialogs/GUIDialogButtonMenu.cpp

http://github.com/xbmc/xbmc
C++ | 44 lines | 28 code | 7 blank | 9 comment | 7 complexity | 7044ae4a15a9635fc4a001dd04da9438 MD5 | raw file
 1/*
 2 *  Copyright (C) 2005-2018 Team Kodi
 3 *  This file is part of Kodi - https://kodi.tv
 4 *
 5 *  SPDX-License-Identifier: GPL-2.0-or-later
 6 *  See LICENSES/README.md for more information.
 7 */
 8
 9#include "GUIDialogButtonMenu.h"
10
11#include "guilib/GUIMessage.h"
12
13#define CONTROL_BUTTON_LABEL  3100
14
15CGUIDialogButtonMenu::CGUIDialogButtonMenu(int id, const std::string &xmlFile)
16: CGUIDialog(id, xmlFile.c_str())
17{
18  m_loadType = KEEP_IN_MEMORY;
19}
20
21CGUIDialogButtonMenu::~CGUIDialogButtonMenu(void) = default;
22
23bool CGUIDialogButtonMenu::OnMessage(CGUIMessage &message)
24{
25  bool bRet = CGUIDialog::OnMessage(message);
26  if (message.GetMessage() == GUI_MSG_CLICKED)
27  {
28    // someone has been clicked - deinit...
29    Close();
30    return true;
31  }
32  return bRet;
33}
34
35void CGUIDialogButtonMenu::FrameMove()
36{
37  // get the active control, and put it's label into the label control
38  const CGUIControl *pControl = GetFocusedControl();
39  if (pControl && (pControl->GetControlType() == CGUIControl::GUICONTROL_BUTTON || pControl->GetControlType() == CGUIControl::GUICONTROL_TOGGLEBUTTON))
40  {
41    SET_CONTROL_LABEL(CONTROL_BUTTON_LABEL, pControl->GetDescription());
42  }
43  CGUIDialog::FrameMove();
44}