libyui-ncurses-rest-api
Loading...
Searching...
No Matches
YNCWidgetActionHandler.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 YNCWidgetActionHandler_h
18#define YNCWidgetActionHandler_h
19
20#include <yui/YEvent.h>
21#include <yui/rest-api/YWidgetActionHandler.h>
22
23#include "YNCHttpUI.h"
24
25
26class YNCWidgetActionHandler : public YWidgetActionHandler
27{
28
29protected:
30
31 virtual void activate_widget( YCheckBoxFrame * widget );
32 virtual void activate_widget( YComboBox * widget );
33 virtual void activate_widget( YDateField * widget );
34 virtual void activate_widget( YSelectionBox * widget );
35 virtual void activate_widget( YTimeField * widget );
36
37 virtual void activate_widget ( YMultiSelectionBox * widget, YItem * item );
38
39private:
40
41 template<typename T>
42 void activate_nc_widget( T * widget ) {
43 if( widget->notify() && dynamic_cast<NCWidget*>( widget ) )
44 {
45 NCursesEvent event = NCursesEvent::Activated;
46 event.widget = dynamic_cast<NCWidget*>( widget );
47 YNCHttpUI::ui()->sendEvent( event );
48 }
49 }
50
51 template<typename T, typename I>
52 void activate_nc_widget( T * widget , I * item) {
53 if( widget->notify() && dynamic_cast<NCWidget*>( widget ) )
54 {
55 NCursesEvent event( NCursesEvent::menu );
56 event.selection = (YMenuItem *) item;
57 event.widget = dynamic_cast<NCWidget*>( widget );
58 YNCHttpUI::ui()->sendEvent( event );
59 }
60 }
61
62};
63
64#endif //YNCWidgetActionHandler_h
Definition YNCWidgetActionHandler.h:27