1 /* 2 * This program is free software; you can redistribute it and/or modify it 3 * under the terms of the GNU Lesser General Public License as published by 4 * the Free Software Foundation. 5 * 6 * This program is distributed in the hope that it will be useful, but 7 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 8 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 9 * for more details. 10 * 11 * You should have received a copy of the GNU Lesser General Public License 12 * along with this program; if not, see <http://www.gnu.org/licenses/>. 13 * 14 * 15 * Authors: 16 * Chris Lahey <clahey@ximian.com> 17 * 18 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) 19 * 20 */ 21 22 #ifndef E_MINICARD_H 23 #define E_MINICARD_H 24 25 #include <gtk/gtk.h> 26 #include <libebook/libebook.h> 27 #include <libgnomecanvas/libgnomecanvas.h> 28 29 /* Standard GObject macros */ 30 #define E_TYPE_MINICARD \ 31 (e_minicard_get_type ()) 32 #define E_MINICARD(obj) \ 33 (G_TYPE_CHECK_INSTANCE_CAST \ 34 ((obj), E_TYPE_MINICARD, EMinicard)) 35 #define E_MINICARD_CLASS(cls) \ 36 (G_TYPE_CHECK_CLASS_CAST \ 37 ((cls), E_TYPE_MINICARD, EMinicardClass)) 38 #define E_IS_MINICARD(obj) \ 39 (G_TYPE_CHECK_INSTANCE_TYPE \ 40 ((obj), E_TYPE_MINICARD)) 41 #define E_IS_MINICARD_CLASS(cls) \ 42 (G_TYPE_CHECK_CLASS_TYPE \ 43 ((obj), E_TYPE_MINICARD)) 44 #define E_MINICARD_GET_CLASS(obj) \ 45 (G_TYPE_INSTANCE_GET_CLASS \ 46 ((obj), E_TYPE_MINICARD, EMinicardClass)) 47 48 G_BEGIN_DECLS 49 50 typedef struct _EMinicard EMinicard; 51 typedef struct _EMinicardClass EMinicardClass; 52 53 typedef enum _EMinicardFocusType EMinicardFocusType; 54 55 enum _EMinicardFocusType { 56 E_MINICARD_FOCUS_TYPE_START, 57 E_MINICARD_FOCUS_TYPE_END 58 }; 59 60 struct _EMinicard 61 { 62 GnomeCanvasGroup parent; 63 64 /* item specific fields */ 65 EContact *contact; 66 67 GnomeCanvasItem *rect; 68 GnomeCanvasItem *header_rect; 69 GnomeCanvasItem *header_text; 70 GnomeCanvasItem *list_icon; 71 72 GdkPixbuf *list_icon_pixbuf; 73 gdouble list_icon_size; 74 75 GList *fields; /* Of type EMinicardField */ 76 guint needs_remodeling : 1; 77 78 guint changed : 1; 79 80 guint selected : 1; 81 guint has_cursor : 1; 82 83 guint has_focus : 1; 84 85 guint editable : 1; 86 87 guint drag_button_down : 1; 88 gint drag_button; 89 90 gint button_x; 91 gint button_y; 92 93 gdouble width; 94 gdouble height; 95 }; 96 97 struct _EMinicardClass 98 { 99 GnomeCanvasGroupClass parent_class; 100 101 gint (* selected) (EMinicard *minicard, GdkEvent *event); 102 gint (* drag_begin) (EMinicard *minicard, GdkEvent *event); 103 void (* open_contact) (EMinicard *minicard, EContact *contact); 104 105 void (* style_updated) (EMinicard *minicard); 106 }; 107 108 typedef struct _EMinicardField EMinicardField; 109 110 struct _EMinicardField { 111 EContactField field; 112 GnomeCanvasItem *label; 113 }; 114 115 #define E_MINICARD_FIELD(field) ((EMinicardField *)(field)) 116 117 GType e_minicard_get_type (void); 118 const gchar * e_minicard_get_card_id (EMinicard *minicard); 119 gint e_minicard_compare (EMinicard *minicard1, 120 EMinicard *minicard2); 121 gint e_minicard_selected (EMinicard *minicard, 122 GdkEvent *event); 123 void e_minicard_activate_editor (EMinicard *minicard); 124 125 G_END_DECLS 126 127 #endif /* E_MINICARD_H */ 128