4 * Copyright (C) 2005-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
23 #include "guilib/GUIDialog.h"
25 class CGUISliderControl;
27 /*! \brief Interface class for callback from the slider dialog
28 Used to pass feedback from the slider dialog to a caller. Users of the
29 slider dialog should derive from this class if they wish to respond to changes
30 in the slider by the user as they happen. OnSliderChange is called in response
31 to the user moving the slider. The caller may then update the text on the slider
32 and update anything that should be changed as the slider is adjusted.
38 virtual ~ISliderCallback() {}
40 /*! \brief Callback function called whenever the user moves the slider
41 \param data pointer of callbackData passed into CGUIDialogSlider::ShowAndGetInput()
42 \param slider pointer to the slider control on the dialog
44 virtual void OnSliderChange(void *data, CGUISliderControl *slider)=0;
47 class CGUIDialogSlider : public CGUIDialog
51 virtual ~CGUIDialogSlider(void);
52 virtual bool OnMessage(CGUIMessage& message);
53 virtual bool OnAction(const CAction &action);
55 /*! \brief Show the slider dialog and wait for the user to change the value
56 Shows the slider until the user is happy with the adjusted value. Calls back with each change to the callback function
57 allowing changes to take place immediately.
58 \param label description of what is being changed by the slider
59 \param value start value of the slider
60 \param min minimal value the slider may take
61 \param delta amount the slider advances for a single click
62 \param max maximal value the slider may take
63 \param callback callback class that implements ISliderCallback::OnSliderChange
64 \param callbackData pointer to callback-specific data (defaults to NULL)
65 \sa ISliderCallback, Display
67 static void ShowAndGetInput(const CStdString &label, float value, float min, float delta, float max, ISliderCallback *callback, void *callbackData = NULL);
69 /*! \brief Show the slider dialog as a response to user input
70 Shows the slider with the given values for a short period of time, used for UI feedback of a set user action.
71 This function is asynchronous.
72 \param label id of the description label for the slider
73 \param value start value of the slider
74 \param min minimal value the slider may take
75 \param delta amount the slider advances for a single click
76 \param max maximal value the slider may take
77 \param callback callback class that implements ISliderCallback::OnSliderChange
78 \sa ISliderCallback, ShowAndGetInput
80 static void Display(int label, float value, float min, float delta, float max, ISliderCallback *callback);
82 void SetSlider(const CStdString &label, float value, float min, float delta, float max, ISliderCallback *callback, void *callbackData);
83 virtual void OnWindowLoaded();
85 ISliderCallback *m_callback;