medit/moo/mooutils/moouixml.h

191 lines
7.1 KiB
C
Raw Normal View History

2005-06-22 11:20:32 -07:00
/*
2005-09-15 09:37:30 -07:00
* moouixml.h
2005-06-22 11:20:32 -07:00
*
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
2005-06-22 11:20:32 -07:00
*
* 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.
*
* See COPYING file that comes with this distribution.
*/
2005-09-15 09:37:30 -07:00
#ifndef __MOO_UI_XML_H__
#define __MOO_UI_XML_H__
2005-06-22 11:20:32 -07:00
#include <mooutils/moomarkup.h>
#include <mooutils/mooactioncollection.h>
2005-06-22 11:20:32 -07:00
G_BEGIN_DECLS
2005-09-15 09:37:30 -07: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 19:43:23 -08:00
typedef enum {
MOO_UI_NODE_ENABLE_EMPTY = 1 << 0
} MooUINodeFlags;
2005-09-15 09:37:30 -07:00
typedef struct _MooUINode MooUINode;
typedef struct _MooUIWidgetNode MooUIWidgetNode;
typedef struct _MooUIItemNode MooUIItemNode;
typedef struct _MooUISeparatorNode MooUISeparatorNode;
typedef struct _MooUIPlaceholderNode MooUIPlaceholderNode;
2006-02-28 19:43:23 -08:00
#define MOO_UI_NODE_STRUCT \
MooUINodeType type; \
char *name; \
MooUINode *parent; \
GSList *children; \
2006-10-20 00:02:13 -07:00
guint flags : 1
2006-02-28 19:43:23 -08:00
2005-09-15 09:37:30 -07:00
struct _MooUINode {
2006-02-28 19:43:23 -08:00
MOO_UI_NODE_STRUCT;
2005-09-15 09:37:30 -07:00
};
struct _MooUIWidgetNode {
2006-02-28 19:43:23 -08:00
MOO_UI_NODE_STRUCT;
2005-09-15 09:37:30 -07:00
};
struct _MooUISeparatorNode {
2006-02-28 19:43:23 -08:00
MOO_UI_NODE_STRUCT;
2005-09-15 09:37:30 -07:00
};
struct _MooUIPlaceholderNode {
2006-02-28 19:43:23 -08:00
MOO_UI_NODE_STRUCT;
2005-09-15 09:37:30 -07:00
};
struct _MooUIItemNode {
2006-02-28 19:43:23 -08:00
MOO_UI_NODE_STRUCT;
2005-09-15 09:37:30 -07:00
char *action;
char *label;
2005-11-18 12:07:56 -08:00
char *tooltip;
char *stock_id;
2005-09-15 09:37:30 -07:00
char *icon_stock_id;
};
typedef enum {
MOO_UI_MENUBAR = 1,
MOO_UI_MENU,
MOO_UI_TOOLBAR
} MooUIWidgetType;
2005-11-06 04:26:19 -08:00
#define MOO_TYPE_UI_NODE (moo_ui_node_get_type ())
#define MOO_TYPE_UI_WIDGET_TYPE (moo_ui_widget_type_get_type ())
2005-06-22 11:20:32 -07: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 09:37:30 -07:00
MooUIXMLPrivate *priv;
2005-06-22 11:20:32 -07:00
};
struct _MooUIXMLClass
{
GObjectClass parent_class;
};
2005-09-15 09:37:30 -07:00
GType moo_ui_xml_get_type (void) G_GNUC_CONST;
2005-11-06 04:26:19 -08:00
GType moo_ui_node_get_type (void) G_GNUC_CONST;
GType moo_ui_widget_type_get_type (void) G_GNUC_CONST;
2005-09-15 09:37:30 -07:00
MooUIXML *moo_ui_xml_new (void);
2005-06-22 11:20:32 -07:00
2005-09-15 09:37:30 -07:00
void moo_ui_xml_add_ui_from_string (MooUIXML *xml,
const char *buffer,
gssize length);
2005-06-22 11:20:32 -07:00
2005-09-15 09:37:30 -07:00
MooUINode *moo_ui_xml_get_node (MooUIXML *xml,
const char *path);
MooUINode *moo_ui_xml_find_node (MooUIXML *xml,
const char *path_or_placeholder);
2005-09-16 10:51:20 -07: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 11:20:32 -07:00
2005-11-18 12:07:56 -08:00
gpointer moo_ui_xml_create_widget (MooUIXML *xml,
2005-09-15 09:37:30 -07:00
MooUIWidgetType type,
const char *path,
MooActionCollection *actions,
2005-09-15 09:37:30 -07:00
GtkAccelGroup *accel_group);
GtkWidget *moo_ui_xml_get_widget (MooUIXML *xml,
GtkWidget *toplevel,
const char *path);
2005-06-22 11:20:32 -07:00
2005-09-15 09:37:30 -07:00
guint moo_ui_xml_new_merge_id (MooUIXML *xml);
2005-09-16 10:51:20 -07:00
2005-09-15 09:37:30 -07: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 10:51:20 -07: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 09:37:30 -07:00
void moo_ui_xml_remove_ui (MooUIXML *xml,
guint merge_id);
2005-06-22 11:20:32 -07:00
2005-09-15 09:37:30 -07:00
void moo_ui_xml_remove_node (MooUIXML *xml,
MooUINode *node);
2005-06-22 11:20:32 -07:00
G_END_DECLS
2005-09-15 09:37:30 -07:00
#endif /* __MOO_UI_XML_H__ */
2005-06-22 11:20:32 -07:00