1 /*
2  * popup-menu-item: An interface implemented by actors used as pop-up menu item
3  *
4  * Copyright 2012-2020 Stephan Haller <nomad@froevel.de>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  *
22  */
23 
24 #ifndef __LIBXFDASHBOARD_POPUP_MENU_ITEM__
25 #define __LIBXFDASHBOARD_POPUP_MENU_ITEM__
26 
27 #if !defined(__LIBXFDASHBOARD_H_INSIDE__) && !defined(LIBXFDASHBOARD_COMPILATION)
28 #error "Only <libxfdashboard/libxfdashboard.h> can be included directly."
29 #endif
30 
31 #include <glib-object.h>
32 
33 G_BEGIN_DECLS
34 
35 #define XFDASHBOARD_TYPE_POPUP_MENU_ITEM				(xfdashboard_popup_menu_item_get_type())
36 #define XFDASHBOARD_POPUP_MENU_ITEM(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), XFDASHBOARD_TYPE_POPUP_MENU_ITEM, XfdashboardPopupMenuItem))
37 #define XFDASHBOARD_IS_POPUP_MENU_ITEM(obj)				(G_TYPE_CHECK_INSTANCE_TYPE((obj), XFDASHBOARD_TYPE_POPUP_MENU_ITEM))
38 #define XFDASHBOARD_POPUP_MENU_ITEM_GET_IFACE(obj)		(G_TYPE_INSTANCE_GET_INTERFACE((obj), XFDASHBOARD_TYPE_POPUP_MENU_ITEM, XfdashboardPopupMenuItemInterface))
39 
40 typedef struct _XfdashboardPopupMenuItem				XfdashboardPopupMenuItem;
41 typedef struct _XfdashboardPopupMenuItemInterface		XfdashboardPopupMenuItemInterface;
42 
43 /**
44  * XfdashboardPopupMenuItemInterface:
45  * @parent_interface: The parent interface.
46  * @get_enabled: Retrieve state if pop-up menu item is enabled or disabled
47  * @set_enabled: Set state if pop-up menu item is enabled or disabled
48  *
49  * Provides an interface implemented by actors which will be used as pop-up menu
50  * items in a #XfdashboardPopupMenu.
51  */
52 struct _XfdashboardPopupMenuItemInterface
53 {
54 	/*< private >*/
55 	/* Parent interface */
56 	GTypeInterface				parent_interface;
57 
58 	/*< public >*/
59 	/* Virtual functions */
60 	gboolean (*get_enabled)(XfdashboardPopupMenuItem *self);
61 	void (*set_enabled)(XfdashboardPopupMenuItem *self, gboolean inEnabled);
62 };
63 
64 /* Public API */
65 GType xfdashboard_popup_menu_item_get_type(void) G_GNUC_CONST;
66 
67 gboolean xfdashboard_popup_menu_item_get_enabled(XfdashboardPopupMenuItem *self);
68 void xfdashboard_popup_menu_item_set_enabled(XfdashboardPopupMenuItem *self, gboolean inEnabled);
69 
70 void xfdashboard_popup_menu_item_activate(XfdashboardPopupMenuItem *self);
71 
72 G_END_DECLS
73 
74 #endif	/* __LIBXFDASHBOARD_POPUP_MENU_ITEM__ */
75