1
#ifndef _GLAME_ACCELERATOR_H
2
#define _GLAME_ACCELERATOR_H
7
* $Id: glame_accelerator.h,v 1.11 2001/12/16 22:26:16 richi Exp $
9
* Copyright (C) 2001 Richard Guenther
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, write to the Free Software
23
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
#include <xmlmemory.h>
33
/* Initialize the accelerator subsystem. Returns 0 on success, -1
35
int glame_accel_init();
37
/* Sync the accelerator table to disk (~.glame-accels). */
38
void glame_accel_sync();
41
/* Constructs the accelerator table from the provided xml document.
42
* Returns 0 on success, -1 on error. */
43
int glame_add_accels_from_xml(const xmlDocPtr xml);
45
/* Adds all accelerators found in the specified file. Returns 0
46
* on success, -1 on error. */
47
int glame_add_accels_from_file(const char *filename);
49
/* Constructs an xml document out of the accelerator table.
50
* Returns the document on success, NULL on error. You have to free
51
* the document yourself. */
52
xmlDocPtr glame_accels_to_xml();
55
/* Adds the binding spec -> action to the accelerator table replacing
56
* an already existing one. Returns 0 on success, -1 on error. */
57
int glame_accel_add(const char *spec, guint state_mask, guint state,
60
/* Deletes all bindings to spec from the accelerator table. */
61
void glame_accel_del(const char *spec, guint state);
63
/* Deletes all bindings to specifications inside the specified scope. */
64
void glame_accel_del_all(const char *scope);
69
struct accel **pprev_accel_hash;
70
struct accel *next_accel_hash;
71
struct glame_list_head list;
78
/* Iterates (safe to delete actual item) through all available
80
extern struct glame_list_head _glame_accel_list;
81
#define glame_accel_safe_foreach(dummy, entry) glame_list_safe_foreach(&_glame_accel_list, struct accel, list, dummy, entry)
84
/* Installs a gtk signal handler to the specified widget which binds
85
* to the accelerators inside the specified scope(s).
86
* Returns the gtk signal identifier on success, 0 on error. */
87
guint glame_accel_install(GtkWidget *widget,
88
const char *scope, ...);
90
/* Callback which executes the binding for the supplied specification
92
* Returns TRUE if found, FALSE otherwise. */
93
guint glame_accel_widget_data_cb(GtkWidget *widget, gpointer spec);
96
/* Accelerator edit/list widget. Operations are restricted to the
97
* specified scope. Pass TRUE to allow editing, FALSE sets read-only. */
98
GtkWidget *glame_accel_edit_widget(const char *scope, int edit);
100
/* Accelerator edit/list dialog. See glame_accel_edit_widget for
101
* options. Parent is the dialog parent window. */
102
GtkWidget *glame_accel_edit_dialog(const char *scope, int edit,