Merge pull request #4594 from FernetMenta/paplayer
[xbmc.git] / xbmc / dialogs / GUIDialogButtonMenu.cpp
blob69e137a5f67b9ca43a3e9454a4194b8f19544ba0
1 /*
2 * Copyright (C) 2005-2013 Team XBMC
3 * http://xbmc.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "GUIDialogButtonMenu.h"
22 #include "guilib/GUILabelControl.h"
23 #include "guilib/GUIButtonControl.h"
26 #define CONTROL_BUTTON_LABEL 3100
28 CGUIDialogButtonMenu::CGUIDialogButtonMenu(int id, const CStdString &xmlFile)
29 : CGUIDialog(id, xmlFile)
31 m_loadType = KEEP_IN_MEMORY;
34 CGUIDialogButtonMenu::~CGUIDialogButtonMenu(void)
37 bool CGUIDialogButtonMenu::OnMessage(CGUIMessage &message)
39 bool bRet = CGUIDialog::OnMessage(message);
40 if (message.GetMessage() == GUI_MSG_CLICKED)
42 // someone has been clicked - deinit...
43 Close();
44 return true;
46 return bRet;
49 void CGUIDialogButtonMenu::FrameMove()
51 // get the label control
52 CGUILabelControl *pLabel = (CGUILabelControl *)GetControl(CONTROL_BUTTON_LABEL);
53 if (pLabel)
55 // get the active window, and put it's label into the label control
56 const CGUIControl *pControl = GetFocusedControl();
57 if (pControl && (pControl->GetControlType() == CGUIControl::GUICONTROL_BUTTON || pControl->GetControlType() == CGUIControl::GUICONTROL_TOGGLEBUTTON))
59 CGUIButtonControl *pButton = (CGUIButtonControl *)pControl;
60 pLabel->SetLabel(pButton->GetLabel());
63 CGUIDialog::FrameMove();