summaryrefslogtreecommitdiff
path: root/tools/glade/glade/glade.h
blob: 0b6d42fb900cc889283fc64416d669eb7bde4f85 (plain)
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
/*  Gtk+ User Interface Builder
 *  Copyright (C) 1998-1999  Damon Chaplin
 *
 *  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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef GLADE_H
#define GLADE_H

#include <gtk/gtkwidget.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/* This is the main header file for the Glade library. */

/* Error codes returned by Glade functions. */
typedef enum
{
  GLADE_STATUS_OK			= 0,

  /* General error, when nothing else is suitable. */
  GLADE_STATUS_ERROR			= 1,

  /* System error. In a GladeError, system_errno will hold the error code. */
  GLADE_STATUS_SYSTEM_ERROR		= 2,

  /* File related errors. */
  GLADE_STATUS_FILE_OPEN_ERROR		= 11,
  GLADE_STATUS_FILE_READ_ERROR		= 12,
  GLADE_STATUS_FILE_WRITE_ERROR		= 13,

  GLADE_STATUS_INVALID_DIRECTORY	= 15,

  /* XML Parsing errors. */
  GLADE_STATUS_INVALID_VALUE		= 20,
  GLADE_STATUS_INVALID_ENTITY		= 21,
  GLADE_STATUS_START_TAG_EXPECTED	= 22,
  GLADE_STATUS_END_TAG_EXPECTED		= 23,
  GLADE_STATUS_DATA_EXPECTED		= 24,
  GLADE_STATUS_CLASS_ID_MISSING		= 25,
  GLADE_STATUS_CLASS_UNKNOWN		= 26,
  GLADE_STATUS_INVALID_COMPONENT	= 27,
  GLADE_STATUS_EOF			= 28
} GladeStatusCode;


/* This is the global clipboard. */
extern GtkWidget *glade_clipboard;

typedef struct _GladeWidgetInitData	GladeWidgetInitData;
typedef struct _GladePaletteSectionData	GladePaletteSectionData;

typedef struct _GladeProject	GladeProject;
typedef struct _GbWidget	GbWidget;

struct _GladeWidgetInitData
{
  gchar *name;
  GbWidget* (*init_func)();
};

struct _GladePaletteSectionData
{
  gchar *section;
  GladeWidgetInitData *widgets;
};


void	    glade_app_init				(void);

void	    glade_load_settings		(gpointer	 project_window,
					 GtkWidget	*palette,
					 gboolean	*show_palette,
					 GtkWidget	*property_editor,
					 gboolean	*show_property_editor,
					 GtkWidget	*widget_tree,
					 gboolean	*show_widget_tree,
					 GtkWidget	*clipboard,
					 gboolean	*show_clipboard);
void	    glade_save_settings		(gpointer	 project_window,
					 GtkWidget	*palette,
					 GtkWidget	*property_editor,
					 GtkWidget	*widget_tree,
					 GtkWidget	*clipboard);
/*
GladeProject* glade_project_new (void);
GladeProject* glade_project_open (gchar *filename);
GladeStatusCode glade_project_save (GladeProject *project);
GladeStatusCode glade_project_set_interface_filename (GladeProject *project);
GladeStatusCode glade_project_set_graphics_directory (GladeProject *project);
*/

void	    glade_show_project_window		(void);
void	    glade_hide_project_window		(void);

void	    glade_show_palette			(void);
void	    glade_hide_palette			(void);

void	    glade_show_property_editor		(void);
void	    glade_hide_property_editor		(void);

void	    glade_show_widget_tree		(void);
void	    glade_hide_widget_tree		(void);

void	    glade_show_clipboard		(void);
void	    glade_hide_clipboard		(void);

void	    glade_show_widget_tooltips		(gboolean	show);

void	    glade_show_grid			(gboolean	show);
void	    glade_snap_to_grid			(gboolean	snap);
#if 0
/* Changed editor_show_grid_settings_dialog and
   editor_show_grid_settings_dialog to take a widget parameter, to use for
   selecting a transient parent.
   These functions don't know about any widgets. Since they're unused,
   they're commented out. I guess it would be even better to remove them
   outright. */
void	    glade_show_grid_settings		(void);
void	    glade_show_snap_settings		(void);
#endif

gchar*	    glade_get_error_message		(GladeStatusCode  status);

GtkAccelGroup* glade_get_global_accel_group	(void);


/*************************************************************************
 * GladeError - an ADT to represent an error which occurred in Glade.
 *              Currently it is only used for writing source, but it may be
 *		extended for all errors, since GladeStatus doesn't really
 *		provide enough detail to show the user useful messages.
 *************************************************************************/

typedef struct _GladeError GladeError;

struct _GladeError
{
  GladeStatusCode status;
  gint system_errno;
  gchar *message;
};

/* Creates a new GladeError with no error set. */
GladeError* glade_error_new			(void);

/* Creates a GladeError with the given Glade status code and the printf-like
   message and arguments. */
GladeError* glade_error_new_general	(GladeStatusCode  status,
					 gchar		 *message,
					 ...);

/* Creates a GladeError using the system errno and the printf-like
   message and arguments. This must be called immediately after the error
   is detected, so that errno is still valid and can be copied into the
   GladeError. */
GladeError* glade_error_new_system	(gchar		 *message,
					 ...);

/* Frees the GladeError and its contents. */
void	    glade_error_free			(GladeError      *error);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* GLADE_H */