~ubuntu-branches/ubuntu/utopic/glame/utopic

« back to all changes in this revision

Viewing changes to src/gui/glame_accelerator.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2002-04-09 17:14:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020409171412-jzpnov7mbz2w6zsr
Tags: upstream-0.6.2
ImportĀ upstreamĀ versionĀ 0.6.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _GLAME_ACCELERATOR_H
 
2
#define _GLAME_ACCELERATOR_H
 
3
 
 
4
/*
 
5
 * glame_accelerator.h
 
6
 *
 
7
 * $Id: glame_accelerator.h,v 1.11 2001/12/16 22:26:16 richi Exp $
 
8
 * 
 
9
 * Copyright (C) 2001 Richard Guenther
 
10
 *
 
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.
 
15
 *
 
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.
 
20
 *
 
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
 
24
 *
 
25
 */
 
26
 
 
27
#include <gtk/gtk.h>
 
28
#include <xmlmemory.h>
 
29
#include <tree.h>
 
30
#include "list.h"
 
31
 
 
32
 
 
33
/* Initialize the accelerator subsystem. Returns 0 on success, -1
 
34
 * on error. */
 
35
int glame_accel_init();
 
36
 
 
37
/* Sync the accelerator table to disk (~.glame-accels). */
 
38
void glame_accel_sync();
 
39
 
 
40
 
 
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);
 
44
 
 
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);
 
48
 
 
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();
 
53
 
 
54
 
 
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,
 
58
                    const char *action);
 
59
 
 
60
/* Deletes all bindings to spec from the accelerator table. */
 
61
void glame_accel_del(const char *spec, guint state);
 
62
 
 
63
/* Deletes all bindings to specifications inside the specified scope. */
 
64
void glame_accel_del_all(const char *scope);
 
65
 
 
66
 
 
67
struct accel;
 
68
struct accel {
 
69
        struct accel **pprev_accel_hash;
 
70
        struct accel *next_accel_hash;
 
71
        struct glame_list_head list;
 
72
        guint state_mask;
 
73
        guint state;
 
74
        char *spec;
 
75
        char *action;
 
76
};
 
77
 
 
78
/* Iterates (safe to delete actual item) through all available
 
79
 * bindings. */
 
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)
 
82
 
 
83
 
 
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, ...);
 
89
 
 
90
/* Callback which executes the binding for the supplied specification
 
91
 * (modifiers are 0).
 
92
 * Returns TRUE if found, FALSE otherwise. */
 
93
guint glame_accel_widget_data_cb(GtkWidget *widget, gpointer spec);
 
94
 
 
95
 
 
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);
 
99
 
 
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,
 
103
                                   GtkWindow *parent);
 
104
 
 
105
 
 
106
#endif