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
|
|
|
*
|
2010-12-21 20:15:45 -08:00
|
|
|
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@users.sourceforge.net>
|
2005-06-22 18:20:32 +00:00
|
|
|
*
|
2008-09-05 17:20:50 -05: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
|
|
|
*
|
2008-09-05 17:20:50 -05: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
|
|
|
*/
|
|
|
|
|
2007-04-12 10:31:28 -05:00
|
|
|
#ifndef MOO_UI_XML_H
|
|
|
|
#define MOO_UI_XML_H
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2005-10-13 14:08:18 +00:00
|
|
|
#include <mooutils/moomarkup.h>
|
2006-08-15 02:12:41 -05:00
|
|
|
#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
|
2010-12-11 00:28:34 -08:00
|
|
|
} MooUiNodeType;
|
2005-09-15 16:37:30 +00:00
|
|
|
|
2006-02-28 21:43:23 -06:00
|
|
|
typedef enum {
|
|
|
|
MOO_UI_NODE_ENABLE_EMPTY = 1 << 0
|
2010-12-11 00:28:34 -08:00
|
|
|
} MooUiNodeFlags;
|
2006-02-28 21:43:23 -06:00
|
|
|
|
2010-12-11 00:28:34 -08:00
|
|
|
typedef struct MooUiNode MooUiNode;
|
|
|
|
typedef struct MooUiWidgetNode MooUiWidgetNode;
|
|
|
|
typedef struct MooUiItemNode MooUiItemNode;
|
|
|
|
typedef struct MooUiSeparatorNode MooUiSeparatorNode;
|
|
|
|
typedef struct MooUiPlaceholderNode MooUiPlaceholderNode;
|
2005-09-15 16:37:30 +00:00
|
|
|
|
|
|
|
|
2006-02-28 21:43:23 -06:00
|
|
|
#define MOO_UI_NODE_STRUCT \
|
2010-12-11 00:28:34 -08:00
|
|
|
MooUiNodeType type; \
|
2006-02-28 21:43:23 -06:00
|
|
|
char *name; \
|
2010-12-11 00:28:34 -08:00
|
|
|
MooUiNode *parent; \
|
2006-02-28 21:43:23 -06:00
|
|
|
GSList *children; \
|
2006-10-20 02:02:13 -05:00
|
|
|
guint flags : 1
|
2006-02-28 21:43:23 -06:00
|
|
|
|
2010-12-11 00:28:34 -08:00
|
|
|
struct MooUiNode {
|
2006-02-28 21:43:23 -06:00
|
|
|
MOO_UI_NODE_STRUCT;
|
2005-09-15 16:37:30 +00:00
|
|
|
};
|
|
|
|
|
2010-12-11 00:28:34 -08:00
|
|
|
struct MooUiWidgetNode {
|
2006-02-28 21:43:23 -06:00
|
|
|
MOO_UI_NODE_STRUCT;
|
2005-09-15 16:37:30 +00:00
|
|
|
};
|
|
|
|
|
2010-12-11 00:28:34 -08:00
|
|
|
struct MooUiSeparatorNode {
|
2006-02-28 21:43:23 -06:00
|
|
|
MOO_UI_NODE_STRUCT;
|
2005-09-15 16:37:30 +00:00
|
|
|
};
|
|
|
|
|
2010-12-11 00:28:34 -08:00
|
|
|
struct MooUiPlaceholderNode {
|
2006-02-28 21:43:23 -06:00
|
|
|
MOO_UI_NODE_STRUCT;
|
2005-09-15 16:37:30 +00:00
|
|
|
};
|
|
|
|
|
2010-12-11 00:28:34 -08: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
|
2010-12-11 00:28:34 -08:00
|
|
|
} MooUiWidgetType;
|
2005-09-15 16:37:30 +00:00
|
|
|
|
|
|
|
|
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 ())
|
2008-09-13 14:56:47 -05:00
|
|
|
#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))
|
2005-06-22 18:20:32 +00:00
|
|
|
#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))
|
2008-09-13 14:56:47 -05:00
|
|
|
#define MOO_UI_XML_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_UI_XML, MooUiXmlClass))
|
2005-06-22 18:20:32 +00:00
|
|
|
|
|
|
|
|
2010-12-08 01:25:34 -08:00
|
|
|
typedef struct _MooUiXml MooUiXml;
|
|
|
|
typedef struct _MooUiXmlPrivate MooUiXmlPrivate;
|
|
|
|
typedef struct _MooUiXmlClass MooUiXmlClass;
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2010-12-08 01:25:34 -08:00
|
|
|
struct _MooUiXml
|
2005-06-22 18:20:32 +00:00
|
|
|
{
|
|
|
|
GObject object;
|
2008-09-13 14:56:47 -05:00
|
|
|
MooUiXmlPrivate *priv;
|
2005-06-22 18:20:32 +00:00
|
|
|
};
|
|
|
|
|
2010-12-08 01:25:34 -08:00
|
|
|
struct _MooUiXmlClass
|
2005-06-22 18:20:32 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
|
2008-09-13 14:56:47 -05:00
|
|
|
MooUiXml *moo_ui_xml_new (void);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2008-09-13 14:56:47 -05:00
|
|
|
void moo_ui_xml_add_ui_from_string (MooUiXml *xml,
|
2005-09-15 16:37:30 +00:00
|
|
|
const char *buffer,
|
2010-12-14 00:49:11 -08:00
|
|
|
int length);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2010-12-11 00:28:34 -08:00
|
|
|
MooUiNode *moo_ui_xml_get_node (MooUiXml *xml,
|
2005-09-15 16:37:30 +00:00
|
|
|
const char *path);
|
2010-12-11 00:28:34 -08:00
|
|
|
MooUiNode *moo_ui_xml_find_placeholder (MooUiXml *xml,
|
2005-09-16 17:51:20 +00:00
|
|
|
const char *name);
|
2010-12-11 00:28:34 -08:00
|
|
|
char *moo_ui_node_get_path (MooUiNode *node);
|
|
|
|
MooUiNode *moo_ui_node_get_child (MooUiNode *node,
|
2005-09-16 17:51:20 +00:00
|
|
|
const char *path);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2008-09-13 14:56:47 -05:00
|
|
|
gpointer moo_ui_xml_create_widget (MooUiXml *xml,
|
2010-12-11 00:28:34 -08:00
|
|
|
MooUiWidgetType type,
|
2005-09-15 16:37:30 +00:00
|
|
|
const char *path,
|
2006-08-15 02:12:41 -05:00
|
|
|
MooActionCollection *actions,
|
2005-09-15 16:37:30 +00:00
|
|
|
GtkAccelGroup *accel_group);
|
2008-09-13 14:56:47 -05:00
|
|
|
GtkWidget *moo_ui_xml_get_widget (MooUiXml *xml,
|
2005-11-26 12:47:46 +00:00
|
|
|
GtkWidget *toplevel,
|
|
|
|
const char *path);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2008-09-13 14:56:47 -05:00
|
|
|
guint moo_ui_xml_new_merge_id (MooUiXml *xml);
|
2005-09-16 17:51:20 +00:00
|
|
|
|
2010-12-11 00:28:34 -08:00
|
|
|
MooUiNode *moo_ui_xml_add_item (MooUiXml *xml,
|
2005-09-15 16:37:30 +00:00
|
|
|
guint merge_id,
|
|
|
|
const char *parent_path,
|
|
|
|
const char *name,
|
|
|
|
const char *action,
|
|
|
|
int position);
|
2005-09-16 17:51:20 +00:00
|
|
|
|
2008-09-13 14:56:47 -05:00
|
|
|
void moo_ui_xml_insert_after (MooUiXml *xml,
|
2005-09-16 17:51:20 +00:00
|
|
|
guint merge_id,
|
2010-12-11 00:28:34 -08:00
|
|
|
MooUiNode *parent,
|
|
|
|
MooUiNode *after,
|
2005-09-16 17:51:20 +00:00
|
|
|
const char *markup);
|
2008-09-13 14:56:47 -05:00
|
|
|
void moo_ui_xml_insert_before (MooUiXml *xml,
|
2005-09-16 17:51:20 +00:00
|
|
|
guint merge_id,
|
2010-12-11 00:28:34 -08:00
|
|
|
MooUiNode *parent,
|
|
|
|
MooUiNode *before,
|
2005-09-16 17:51:20 +00:00
|
|
|
const char *markup);
|
2008-09-13 14:56:47 -05:00
|
|
|
void moo_ui_xml_insert (MooUiXml *xml,
|
2005-09-16 17:51:20 +00:00
|
|
|
guint merge_id,
|
2010-12-11 00:28:34 -08:00
|
|
|
MooUiNode *parent,
|
2005-09-16 17:51:20 +00:00
|
|
|
int position,
|
|
|
|
const char *markup);
|
|
|
|
|
2008-09-13 14:56:47 -05:00
|
|
|
void moo_ui_xml_insert_markup_after (MooUiXml *xml,
|
2005-09-16 17:51:20 +00:00
|
|
|
guint merge_id,
|
|
|
|
const char *parent_path,
|
|
|
|
const char *after,
|
|
|
|
const char *markup);
|
2008-09-13 14:56:47 -05:00
|
|
|
void moo_ui_xml_insert_markup_before (MooUiXml *xml,
|
2005-09-16 17:51:20 +00:00
|
|
|
guint merge_id,
|
|
|
|
const char *parent_path,
|
|
|
|
const char *before,
|
|
|
|
const char *markup);
|
2008-09-13 14:56:47 -05:00
|
|
|
void moo_ui_xml_insert_markup (MooUiXml *xml,
|
2005-09-16 17:51:20 +00:00
|
|
|
guint merge_id,
|
|
|
|
const char *parent_path,
|
|
|
|
int position,
|
|
|
|
const char *markup);
|
|
|
|
|
2008-09-13 14:56:47 -05:00
|
|
|
void moo_ui_xml_remove_ui (MooUiXml *xml,
|
2005-09-15 16:37:30 +00:00
|
|
|
guint merge_id);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2008-09-13 14:56:47 -05:00
|
|
|
void moo_ui_xml_remove_node (MooUiXml *xml,
|
2010-12-11 00:28:34 -08:00
|
|
|
MooUiNode *node);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2007-04-12 10:31:28 -05:00
|
|
|
#endif /* MOO_UI_XML_H */
|