Merge pull request #4594 from FernetMenta/paplayer
[xbmc.git] / xbmc / dialogs / GUIDialogOK.cpp
blobffefc4df1dbee36f7cbcbf0c4e9d63fa3f00947c
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 "GUIDialogOK.h"
22 #include "guilib/GUIWindowManager.h"
24 #define ID_BUTTON_OK 10
26 CGUIDialogOK::CGUIDialogOK(void)
27 : CGUIDialogBoxBase(WINDOW_DIALOG_OK, "DialogOK.xml")
31 CGUIDialogOK::~CGUIDialogOK(void)
34 bool CGUIDialogOK::OnMessage(CGUIMessage& message)
36 if (message.GetMessage() == GUI_MSG_CLICKED)
38 int iControl = message.GetSenderId();
39 if (iControl == ID_BUTTON_OK)
41 m_bConfirmed = true;
42 Close();
43 return true;
46 return CGUIDialogBoxBase::OnMessage(message);
49 // \brief Show CGUIDialogOK dialog, then wait for user to dismiss it.
50 void CGUIDialogOK::ShowAndGetInput(const CVariant &heading, const CVariant &text)
52 CGUIDialogOK *dialog = (CGUIDialogOK *)g_windowManager.GetWindow(WINDOW_DIALOG_OK);
53 if (!dialog)
54 return;
55 dialog->SetHeading(heading);
56 dialog->SetText(text);
57 dialog->DoModal();
60 // \brief Show CGUIDialogOK dialog, then wait for user to dismiss it.
61 void CGUIDialogOK::ShowAndGetInput(const CVariant &heading, const CVariant &line0, const CVariant &line1, const CVariant &line2)
63 CGUIDialogOK *dialog = (CGUIDialogOK *)g_windowManager.GetWindow(WINDOW_DIALOG_OK);
64 if (!dialog)
65 return;
66 dialog->SetHeading(heading);
67 dialog->SetLine(0, line0);
68 dialog->SetLine(1, line1);
69 dialog->SetLine(2, line2);
70 dialog->DoModal();
73 int CGUIDialogOK::GetDefaultLabelID(int controlId) const
75 if (controlId == ID_BUTTON_OK)
76 return 186;
77 return CGUIDialogBoxBase::GetDefaultLabelID(controlId);