libyui-qt-rest-api
Loading...
Searching...
No Matches
YQWidgetActionHandler.h
1/*
2 Copyright (C) 2020 SUSE LLC
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) version 3.0 of the License. This library
8 is distributed in the hope that it will be useful, but WITHOUT ANY
9 WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11 License for more details. You should have received a copy of the GNU
12 Lesser General Public License along with this library; if not, write
13 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
14 Floor, Boston, MA 02110-1301 USA
15*/
16
17#ifndef YQWidgetActionHandler_h
18#define YQWidgetActionHandler_h
19
20#include <yui/YEvent.h>
21#include <yui/rest-api/YWidgetActionHandler.h>
22#include "YQHttpUI.h"
23
24
25class YQWidgetActionHandler : public YWidgetActionHandler
26{
27
28public:
29 virtual void activate_widget( YCheckBoxFrame * widget );
30 virtual void activate_widget( YComboBox * widget );
31 virtual void activate_widget( YDateField * widget );
32 virtual void activate_widget( YInputField * widget );
33 virtual void activate_widget( YRadioButton * widget );
34 virtual void activate_widget( YSelectionBox * widget );
35 virtual void activate_widget( YTimeField * widget );
36
37private:
38 template<typename T>
39 void activate_qt_widget( T * widget ) {
40 if( widget->notify() )
41 YQHttpUI::ui()->sendEvent( new YWidgetEvent( widget, YEvent::ValueChanged ) );
42 }
43
44 template<typename T, typename I>
45 void activate_qt_widget( T * widget , I * item) {
46 if( widget->notify() )
47 {
48 YQHttpUI::ui()->sendEvent( new YMenuEvent( item ) );
49 }
50 }
51};
52
53#endif //YQWidgetActionHandler_h
Definition YQWidgetActionHandler.h:26