~ubuntu-branches/debian/sid/gnome-main-menu/sid

« back to all changes in this revision

Viewing changes to libslab/tile.h

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2009-11-08 21:22:49 UTC
  • mto: (5.1.3 squeeze)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20091108212249-9cql8cptajeua2eh
Tags: upstream-0.9.13
ImportĀ upstreamĀ versionĀ 0.9.13

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of libtile.
3
 
 *
4
 
 * Copyright (c) 2006 Novell, Inc.
5
 
 *
6
 
 * Libtile is free software; you can redistribute it and/or modify it under the
7
 
 * terms of the GNU Lesser General Public License as published by the Free
8
 
 * Software Foundation; either version 2 of the License, or (at your option)
9
 
 * any later version.
10
 
 *
11
 
 * Libtile is distributed in the hope that it will be useful, but WITHOUT ANY
12
 
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
 
 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
14
 
 * more details.
15
 
 *
16
 
 * You should have received a copy of the GNU Lesser General Public License
17
 
 * along with libslab; if not, write to the Free Software Foundation, Inc., 51
18
 
 * Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 
 */
20
 
 
21
 
#ifndef __TILE_H__
22
 
#define __TILE_H__
23
 
 
24
 
#include <glib.h>
25
 
#include <gtk/gtk.h>
26
 
 
27
 
G_BEGIN_DECLS
28
 
 
29
 
#define TILE_TYPE         (tile_get_type ())
30
 
#define TILE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TILE_TYPE, Tile))
31
 
#define TILE_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c), TILE_TYPE, TileClass))
32
 
#define IS_TILE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TILE_TYPE))
33
 
#define IS_TILE_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c), TILE_TYPE))
34
 
#define TILE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TILE_TYPE, TileClass))
35
 
#define TILE_ACTION_TYPE         (tile_action_get_type ())
36
 
#define TILE_ACTION(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TILE_ACTION_TYPE, TileAction))
37
 
#define TILE_ACTION_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c), TILE_ACTION_TYPE, TileActionClass))
38
 
#define IS_TILE_ACTION(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TILE_ACTION_TYPE))
39
 
#define IS_TILE_ACTION_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c), TILE_ACTION_TYPE))
40
 
#define TILE_ACTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TILE_ACTION_TYPE, TileActionClass))
41
 
#define TILE_ACTION_CHECK_FLAG(action,flag) ((TILE_ACTION (action)->flags & (flag)) != 0)
42
 
#define TILE_STATE_ENTERED GTK_STATE_PRELIGHT
43
 
#define TILE_STATE_FOCUSED GTK_STATE_PRELIGHT
44
 
 
45
 
typedef struct _Tile Tile;
46
 
typedef struct _TileClass TileClass;
47
 
typedef struct _TileAction TileAction;
48
 
typedef struct _TileActionClass TileActionClass;
49
 
typedef struct _TileEvent TileEvent;
50
 
 
51
 
typedef void (*TileActionFunc) (Tile *, TileEvent *, TileAction *);
52
 
 
53
 
typedef enum
54
 
{
55
 
        TILE_EVENT_ACTIVATED_SINGLE_CLICK,
56
 
        TILE_EVENT_ACTIVATED_DOUBLE_CLICK,
57
 
        TILE_EVENT_ACTIVATED_KEYBOARD,
58
 
        TILE_EVENT_IMPLICIT_DISABLE,
59
 
        TILE_EVENT_IMPLICIT_ENABLE,
60
 
        TILE_EVENT_ACTION_TRIGGERED
61
 
} TileEventType;
62
 
 
63
 
typedef enum
64
 
{
65
 
        TILE_ACTION_OPENS_NEW_WINDOW = 1 << 0,
66
 
        TILE_ACTION_OPENS_HELP = 1 << 1
67
 
} TileActionFlags;
68
 
 
69
 
struct _Tile
70
 
{
71
 
        GtkButton gtk_button;
72
 
 
73
 
        gchar *uri;
74
 
        GtkMenu *context_menu;
75
 
        gboolean entered;
76
 
        gboolean enabled;
77
 
 
78
 
        TileAction **actions;
79
 
        gint n_actions;
80
 
 
81
 
        TileAction *default_action;
82
 
};
83
 
 
84
 
struct _TileClass
85
 
{
86
 
        GtkButtonClass gtk_button_class;
87
 
 
88
 
        void (*tile_explicit_enable) (Tile *);
89
 
        void (*tile_explicit_disable) (Tile *);
90
 
 
91
 
        void (*tile_activated) (Tile *, TileEvent *);
92
 
        void (*tile_implicit_enable) (Tile *, TileEvent *);
93
 
        void (*tile_implicit_disable) (Tile *, TileEvent *);
94
 
        void (*tile_action_triggered) (Tile *, TileEvent *, TileAction *);
95
 
};
96
 
 
97
 
struct _TileAction
98
 
{
99
 
        GObject parent;
100
 
 
101
 
        Tile *tile;
102
 
 
103
 
        TileActionFunc func;
104
 
        GtkMenuItem *menu_item;
105
 
 
106
 
        guint32 flags;
107
 
};
108
 
 
109
 
struct _TileActionClass
110
 
{
111
 
        GObjectClass parent_class;
112
 
};
113
 
 
114
 
struct _TileEvent
115
 
{
116
 
        TileEventType type;
117
 
        guint32 time;
118
 
};
119
 
 
120
 
GType tile_get_type (void);
121
 
GType tile_action_get_type (void);
122
 
 
123
 
gint tile_compare (gconstpointer a, gconstpointer b);
124
 
 
125
 
void tile_explicit_enable (Tile * tile);
126
 
void tile_explicit_disable (Tile * tile);
127
 
 
128
 
void tile_implicit_enable (Tile * tile);
129
 
void tile_implicit_disable (Tile * tile);
130
 
void tile_implicit_enable_with_time (Tile * tile, guint32 time);
131
 
void tile_implicit_disable_with_time (Tile * tile, guint32 time);
132
 
 
133
 
void tile_trigger_action (Tile * tile, TileAction * action);
134
 
void tile_trigger_action_with_time (Tile * tile, TileAction * action, guint32 time);
135
 
 
136
 
TileAction *tile_action_new (Tile * tile, TileActionFunc func, const gchar * menu_item_markup,
137
 
        guint32 flags);
138
 
 
139
 
void tile_action_set_menu_item_label (TileAction * action, const gchar * markup);
140
 
GtkMenuItem *tile_action_get_menu_item (TileAction * action);
141
 
 
142
 
G_END_DECLS
143
 
#endif