1 /*
2  * Copyright (C) 2006 Juan Pablo Ugarte.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * Authors:
19  *   Juan Pablo Ugarte <juanpablougarte@gmail.com>
20  */
21 #ifndef __GLADE_BASE_EDITOR_H__
22 #define __GLADE_BASE_EDITOR_H__
23 
24 #include <gladeui/glade-widget.h>
25 
26 #include <gtk/gtk.h>
27 
28 G_BEGIN_DECLS
29 
30 #define GLADE_TYPE_BASE_EDITOR         (glade_base_editor_get_type ())
31 #define GLADE_BASE_EDITOR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GLADE_TYPE_BASE_EDITOR, GladeBaseEditor))
32 #define GLADE_BASE_EDITOR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GLADE_TYPE_BASE_EDITOR, GladeBaseEditorClass))
33 #define GLADE_IS_BASE_EDITOR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GLADE_TYPE_BASE_EDITOR))
34 #define GLADE_IS_BASE_EDITOR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GLADE_TYPE_BASE_EDITOR))
35 #define GLADE_BASE_EDITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_TYPE_BASE_EDITOR, GladeBaseEditorClass))
36 
37 typedef struct _GladeBaseEditor        GladeBaseEditor;
38 typedef struct _GladeBaseEditorPrivate GladeBaseEditorPrivate;
39 typedef struct _GladeBaseEditorClass   GladeBaseEditorClass;
40 
41 struct _GladeBaseEditor
42 {
43   GtkBox parent;
44 
45   GladeBaseEditorPrivate *priv;
46 };
47 
48 struct _GladeBaseEditorClass
49 {
50   GtkBoxClass parent_class;
51 
52   void          (*child_selected)   (GladeBaseEditor *, GladeWidget *);
53   gboolean      (*change_type)      (GladeBaseEditor *, GladeWidget *, GType);
54   gchar *       (*get_display_name) (GladeBaseEditor *, GladeWidget *);
55   GladeWidget * (*build_child)      (GladeBaseEditor *, GladeWidget *, GType);
56   gboolean      (*delete_child)     (GladeBaseEditor *, GladeWidget *, GladeWidget *);
57   gboolean      (*move_child)       (GladeBaseEditor *, GladeWidget *, GladeWidget *);
58 
59   void   (* glade_reserved1)   (void);
60   void   (* glade_reserved2)   (void);
61   void   (* glade_reserved3)   (void);
62   void   (* glade_reserved4)   (void);
63   void   (* glade_reserved5)   (void);
64   void   (* glade_reserved6)   (void);
65 };
66 
67 
68 GType                glade_base_editor_get_type               (void);
69 
70 GladeBaseEditor     *glade_base_editor_new                    (GObject *container,
71 							       GladeEditable *main_editable,
72 							       ...);
73 
74 void                 glade_base_editor_append_types           (GladeBaseEditor *editor,
75 							       GType parent_type,
76 							       ...);
77 
78 void                 glade_base_editor_add_editable           (GladeBaseEditor     *editor,
79 							       GladeWidget         *gchild,
80 							       GladeEditorPageType  page);
81 
82 void                 glade_base_editor_add_default_properties (GladeBaseEditor *editor,
83 							       GladeWidget *gchild);
84 
85 void                 glade_base_editor_add_properties         (GladeBaseEditor *editor,
86 							       GladeWidget *gchild,
87 							       gboolean packing,
88 							       ...);
89 
90 void                 glade_base_editor_add_label              (GladeBaseEditor *editor,
91 							       gchar *str);
92 
93 void                 glade_base_editor_set_show_signal_editor (GladeBaseEditor *editor,
94 							       gboolean val);
95 
96 /* Convenience functions */
97 GtkWidget           *glade_base_editor_pack_new_window        (GladeBaseEditor *editor,
98 							       gchar *title,
99 							       gchar *help_markup);
100 
101 G_END_DECLS
102 
103 #endif /* __GLADE_BASE_EDITOR_H__ */
104