medit/moo/mooutils/moouixml.h

188 lines
6.9 KiB
C
Raw Normal View History

2005-06-22 18:20:32 +00:00
/*
2005-09-15 16:37:30 +00:00
* moouixml.h
2005-06-22 18:20:32 +00:00
*
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@tamu.edu>
2005-06-22 18:20:32 +00:00
*
* This file is part of medit. medit is free software; you can
* redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License,
* or (at your option) any later version.
2005-06-22 18:20:32 +00:00
*
* You should have received a copy of the GNU Lesser General Public
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
2005-06-22 18:20:32 +00:00
*/
#ifndef MOO_UI_XML_H
#define MOO_UI_XML_H
2005-06-22 18:20:32 +00:00
#include <mooutils/moomarkup.h>
#include <mooutils/mooactioncollection.h>
2005-06-22 18:20:32 +00:00
G_BEGIN_DECLS
2005-09-15 16:37:30 +00:00
typedef enum {
MOO_UI_NODE_CONTAINER = 1,
MOO_UI_NODE_WIDGET,
MOO_UI_NODE_ITEM,
MOO_UI_NODE_SEPARATOR,
MOO_UI_NODE_PLACEHOLDER
} MooUINodeType;
2006-02-28 21:43:23 -06:00
typedef enum {
MOO_UI_NODE_ENABLE_EMPTY = 1 << 0
} MooUINodeFlags;
2005-09-15 16:37:30 +00:00
typedef struct _MooUINode MooUINode;
typedef struct _MooUIWidgetNode MooUIWidgetNode;
typedef struct _MooUIItemNode MooUIItemNode;
typedef struct _MooUISeparatorNode MooUISeparatorNode;
typedef struct _MooUIPlaceholderNode MooUIPlaceholderNode;
2006-02-28 21:43:23 -06:00
#define MOO_UI_NODE_STRUCT \
MooUINodeType type; \
char *name; \
MooUINode *parent; \
GSList *children; \
2006-10-20 02:02:13 -05:00
guint flags : 1
2006-02-28 21:43:23 -06:00
2005-09-15 16:37:30 +00:00
struct _MooUINode {
2006-02-28 21:43:23 -06:00
MOO_UI_NODE_STRUCT;
2005-09-15 16:37:30 +00:00
};
struct _MooUIWidgetNode {
2006-02-28 21:43:23 -06:00
MOO_UI_NODE_STRUCT;
2005-09-15 16:37:30 +00:00
};
struct _MooUISeparatorNode {
2006-02-28 21:43:23 -06:00
MOO_UI_NODE_STRUCT;
2005-09-15 16:37:30 +00:00
};
struct _MooUIPlaceholderNode {
2006-02-28 21:43:23 -06:00
MOO_UI_NODE_STRUCT;
2005-09-15 16:37:30 +00:00
};
struct _MooUIItemNode {
2006-02-28 21:43:23 -06:00
MOO_UI_NODE_STRUCT;
2005-09-15 16:37:30 +00:00
char *action;
char *label;
2005-11-18 20:07:56 +00:00
char *tooltip;
char *stock_id;
2005-09-15 16:37:30 +00:00
char *icon_stock_id;
};
typedef enum {
MOO_UI_MENUBAR = 1,
MOO_UI_MENU,
MOO_UI_TOOLBAR
} MooUIWidgetType;
2005-11-06 12:26:19 +00:00
#define MOO_TYPE_UI_NODE (moo_ui_node_get_type ())
2005-06-22 18:20:32 +00:00
#define MOO_TYPE_UI_XML (moo_ui_xml_get_type ())
#define MOO_UI_XML(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_UI_XML, MooUIXML))
#define MOO_UI_XML_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_UI_XML, MooUIXMLClass))
#define MOO_IS_UI_XML(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_UI_XML))
#define MOO_IS_UI_XML_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_UI_XML))
#define MOO_UI_XML_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_UI_XML, MooUIXMLClass))
typedef struct _MooUIXML MooUIXML;
typedef struct _MooUIXMLPrivate MooUIXMLPrivate;
typedef struct _MooUIXMLClass MooUIXMLClass;
struct _MooUIXML
{
GObject object;
2005-09-15 16:37:30 +00:00
MooUIXMLPrivate *priv;
2005-06-22 18:20:32 +00:00
};
struct _MooUIXMLClass
{
GObjectClass parent_class;
};
2005-09-15 16:37:30 +00:00
GType moo_ui_xml_get_type (void) G_GNUC_CONST;
2005-11-06 12:26:19 +00:00
GType moo_ui_node_get_type (void) G_GNUC_CONST;
2005-09-15 16:37:30 +00:00
MooUIXML *moo_ui_xml_new (void);
2005-06-22 18:20:32 +00:00
2005-09-15 16:37:30 +00:00
void moo_ui_xml_add_ui_from_string (MooUIXML *xml,
const char *buffer,
gssize length);
2005-06-22 18:20:32 +00:00
2005-09-15 16:37:30 +00:00
MooUINode *moo_ui_xml_get_node (MooUIXML *xml,
const char *path);
2005-09-16 17:51:20 +00:00
MooUINode *moo_ui_xml_find_placeholder (MooUIXML *xml,
const char *name);
char *moo_ui_node_get_path (MooUINode *node);
MooUINode *moo_ui_node_get_child (MooUINode *node,
const char *path);
2005-06-22 18:20:32 +00:00
2005-11-18 20:07:56 +00:00
gpointer moo_ui_xml_create_widget (MooUIXML *xml,
2005-09-15 16:37:30 +00:00
MooUIWidgetType type,
const char *path,
MooActionCollection *actions,
2005-09-15 16:37:30 +00:00
GtkAccelGroup *accel_group);
GtkWidget *moo_ui_xml_get_widget (MooUIXML *xml,
GtkWidget *toplevel,
const char *path);
2005-06-22 18:20:32 +00:00
2005-09-15 16:37:30 +00:00
guint moo_ui_xml_new_merge_id (MooUIXML *xml);
2005-09-16 17:51:20 +00:00
2005-09-15 16:37:30 +00:00
MooUINode *moo_ui_xml_add_item (MooUIXML *xml,
guint merge_id,
const char *parent_path,
const char *name,
const char *action,
int position);
2005-09-16 17:51:20 +00:00
void moo_ui_xml_insert_after (MooUIXML *xml,
guint merge_id,
MooUINode *parent,
MooUINode *after,
const char *markup);
void moo_ui_xml_insert_before (MooUIXML *xml,
guint merge_id,
MooUINode *parent,
MooUINode *before,
const char *markup);
void moo_ui_xml_insert (MooUIXML *xml,
guint merge_id,
MooUINode *parent,
int position,
const char *markup);
void moo_ui_xml_insert_markup_after (MooUIXML *xml,
guint merge_id,
const char *parent_path,
const char *after,
const char *markup);
void moo_ui_xml_insert_markup_before (MooUIXML *xml,
guint merge_id,
const char *parent_path,
const char *before,
const char *markup);
void moo_ui_xml_insert_markup (MooUIXML *xml,
guint merge_id,
const char *parent_path,
int position,
const char *markup);
2005-09-15 16:37:30 +00:00
void moo_ui_xml_remove_ui (MooUIXML *xml,
guint merge_id);
2005-06-22 18:20:32 +00:00
2005-09-15 16:37:30 +00:00
void moo_ui_xml_remove_node (MooUIXML *xml,
MooUINode *node);
2005-06-22 18:20:32 +00:00
G_END_DECLS
#endif /* MOO_UI_XML_H */