1 /* 2 * Copyright (C) 2016 Alberts Muktupāvels 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef SN_ITEM_H 19 #define SN_ITEM_H 20 21 #include <gtk/gtk.h> 22 23 #include "sn-flat-button.h" 24 25 G_BEGIN_DECLS 26 27 #define SN_TYPE_ITEM (sn_item_get_type ()) 28 #define SN_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SN_TYPE_ITEM, SnItem)) 29 #define SN_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SN_TYPE_ITEM, SnItemClass)) 30 #define SN_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SN_TYPE_ITEM)) 31 #define SN_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SN_TYPE_ITEM)) 32 #define SN_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SN_TYPE_ITEM, SnItemClass)) 33 34 typedef enum 35 { 36 SN_ITEM_ORIENTATION_HORIZONTAL, 37 SN_ITEM_ORIENTATION_VERTICAL 38 } SnItemOrientation; 39 40 typedef struct _SnItem SnItem; 41 typedef struct _SnItemPrivate SnItemPrivate; 42 typedef struct _SnItemClass SnItemClass; 43 44 struct _SnItem 45 { 46 SnFlatButtonClass parent_instance; 47 48 SnItemPrivate *priv; 49 }; 50 51 struct _SnItemClass 52 { 53 SnFlatButtonClass parent_class; 54 55 void (* ready) (SnItem *item); 56 57 const gchar * (* get_id) (SnItem *item); 58 59 const gchar * (* get_category) (SnItem *item); 60 61 const gchar * (* get_menu) (SnItem *item); 62 63 void (* context_menu) (SnItem *item, 64 gint x, 65 gint y); 66 67 void (* activate) (SnItem *item, 68 gint x, 69 gint y); 70 71 void (* secondary_activate) (SnItem *item, 72 gint x, 73 gint y); 74 75 void (* scroll) (SnItem *item, 76 gint delta, 77 SnItemOrientation orientation); 78 }; 79 80 GType sn_item_get_type (void); 81 const gchar *sn_item_get_bus_name (SnItem *item); 82 const gchar *sn_item_get_object_path (SnItem *item); 83 84 void sn_item_emit_ready (SnItem *item); 85 86 G_END_DECLS 87 88 #endif 89