1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
/*
* Copyright (C) 2002 Joaquín Cuenca Abela
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Authors:
* Joaquín Cuenca Abela <e98cuenc@yahoo.com>
* Archit Baweja <bighead@users.sourceforge.net>
*/
#ifndef __GLADE_COMMAND_H__
#define __GLADE_COMMAND_H__
#include <gladeui/glade-placeholder.h>
#include <gladeui/glade-widget.h>
#include <gladeui/glade-signal.h>
#include <gladeui/glade-property.h>
#include <gladeui/glade-project.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define GLADE_TYPE_COMMAND glade_command_get_type ()
G_DECLARE_DERIVABLE_TYPE (GladeCommand, glade_command, GLADE, COMMAND, GObject)
typedef struct _GladeCommandSetPropData GladeCommandSetPropData;
/**
* GladeCommandSetPropData
* @property: A #GladeProperty to set
* @new_value: The new #GValue to assign to @property
* @old_value: The old #GValue of @property
*
* #GladeProperty can be set in a list as one command,
* for Undo purposes; we store the list of #GladeCommandSetPropData with
* their old and new #GValue.
*/
struct _GladeCommandSetPropData {
GladeProperty *property;
GValue *new_value;
GValue *old_value;
};
struct _GladeCommandClass
{
GObjectClass parent_class;
gboolean (* execute) (GladeCommand *command);
gboolean (* undo) (GladeCommand *command);
gboolean (* unifies) (GladeCommand *command, GladeCommand *other);
void (* collapse) (GladeCommand *command, GladeCommand *other);
gpointer padding[4];
};
void glade_command_push_group (const gchar *fmt,
...) G_GNUC_PRINTF (1, 2);
void glade_command_pop_group (void);
gint glade_command_get_group_depth (void);
const gchar *glade_command_description (GladeCommand *command);
gint glade_command_group_id (GladeCommand *command);
gboolean glade_command_execute (GladeCommand *command);
gboolean glade_command_undo (GladeCommand *command);
gboolean glade_command_unifies (GladeCommand *command,
GladeCommand *other);
void glade_command_collapse (GladeCommand *command,
GladeCommand *other);
/************************ project ******************************/
void glade_command_set_project_target (GladeProject *project,
const gchar *catalog,
gint major,
gint minor);
void glade_command_set_project_domain (GladeProject *project,
const gchar *domain);
void glade_command_set_project_template(GladeProject *project,
GladeWidget *widget);
void glade_command_set_project_license (GladeProject *project,
const gchar *license);
void glade_command_set_project_resource_path (GladeProject *project,
const gchar *path);
/************************** properties *********************************/
void glade_command_set_property_enabled(GladeProperty *property,
gboolean enabled);
void glade_command_set_property (GladeProperty *property,
...);
void glade_command_set_property_value (GladeProperty *property,
const GValue *value);
void glade_command_set_properties (GladeProperty *property,
const GValue *old_value,
const GValue *new_value,
...);
void glade_command_set_properties_list (GladeProject *project,
GList *props); /* list of GladeCommandSetPropData */
/************************** name ******************************/
void glade_command_set_name (GladeWidget *glade_widget, const gchar *name);
/************************ protection ******************************/
void glade_command_lock_widget (GladeWidget *widget,
GladeWidget *locked);
void glade_command_unlock_widget (GladeWidget *widget);
/************************ create/add/delete ******************************/
void glade_command_add (GList *widgets,
GladeWidget *parent,
GladePlaceholder *placeholder,
GladeProject *project,
gboolean pasting);
void glade_command_delete (GList *widgets);
GladeWidget *glade_command_create (GladeWidgetAdaptor *adaptor,
GladeWidget *parent,
GladePlaceholder *placeholder,
GladeProject *project);
/************************ cut/paste/dnd ******************************/
void glade_command_cut (GList *widgets);
void glade_command_paste (GList *widgets,
GladeWidget *parent,
GladePlaceholder *placeholder,
GladeProject *project);
void glade_command_dnd (GList *widgets,
GladeWidget *parent,
GladePlaceholder *placeholder);
/************************ signals ******************************/
void glade_command_add_signal (GladeWidget *glade_widget,
const GladeSignal *signal);
void glade_command_remove_signal (GladeWidget *glade_widget,
const GladeSignal *signal);
void glade_command_change_signal (GladeWidget *glade_widget,
const GladeSignal *old_signal,
const GladeSignal *new_signal);
/************************ set i18n ******************************/
void glade_command_set_i18n (GladeProperty *property,
gboolean translatable,
const gchar *context,
const gchar *comment);
G_END_DECLS
#endif /* __GLADE_COMMAND_H__ */
|