Filter:   InfoImg
download bonobo-ui-sync.h
Language: C
Copyright: Copyright 2000 Helix Code, Inc.
LOC: 116
Project Info
libbonoboui
Server: Gnome
Type: cvs
...onoboui\libbonoboui\bonobo\
   .cvsignore
   bonobo-a11y.c
   bonobo-a11y.h
   bonobo-canvas-component.c
   bonobo-canvas-component.h
   bonobo-canvas-item.c
   bonobo-canvas-item.h
   bonobo-control-frame.c
   bonobo-control-frame.h
   bonobo-control-internal.h
   bonobo-control.c
   bonobo-control.h
   bonobo-dock-band.c
   bonobo-dock-band.h
   bonobo-dock-item-grip.c
   bonobo-dock-item-grip.h
   bonobo-dock-item.c
   bonobo-dock-item.h
   bonobo-dock-layout.c
   bonobo-dock-layout.h
   bonobo-dock.c
   bonobo-dock.h
   ...bo-embeddable-factory.h
   ...bo-file-selector-util.c
   ...bo-file-selector-util.h
   ...bo-insert-component.xpm
   bonobo-plug.c
   bonobo-plug.h
   bonobo-property-control.c
   bonobo-property-control.h
   bonobo-selector-widget.c
   bonobo-selector-widget.h
   bonobo-selector.c
   bonobo-selector.h
   bonobo-socket.c
   bonobo-socket.h
   bonobo-ui-component.c
   bonobo-ui-component.h
   bonobo-ui-config-widget.c
   bonobo-ui-config-widget.h
   bonobo-ui-container.c
   bonobo-ui-container.h
   bonobo-ui-engine-config.c
   bonobo-ui-engine-config.h
   bonobo-ui-engine-private.h
   bonobo-ui-engine.c
   bonobo-ui-engine.h
   bonobo-ui-init-gtk.c
   ...o-ui-internal-toolbar.c
   bonobo-ui-main.c
   bonobo-ui-main.h
   bonobo-ui-marshal-main.c
   bonobo-ui-marshal.list
   bonobo-ui-node-private.h
   bonobo-ui-node.c
   bonobo-ui-node.h
   bonobo-ui-preferences.c
   bonobo-ui-preferences.h
   bonobo-ui-private.h
   bonobo-ui-sync-keys.c
   bonobo-ui-sync-keys.h
   bonobo-ui-sync-menu.c
   bonobo-ui-sync-menu.h
   bonobo-ui-sync-status.c
   bonobo-ui-sync-status.h
   bonobo-ui-sync-toolbar.c
   bonobo-ui-sync-toolbar.h
   bonobo-ui-sync.c
   bonobo-ui-sync.h
   ...i-toolbar-button-item.c
   ...i-toolbar-button-item.h
   ...-toolbar-control-item.c
   ...-toolbar-control-item.h
   bonobo-ui-toolbar-item.c
   bonobo-ui-toolbar-item.h
   ...ui-toolbar-popup-item.c
   ...ui-toolbar-popup-item.h
   ...ar-toggle-button-item.c
   ...ar-toggle-button-item.h
   bonobo-ui-toolbar.c
   bonobo-ui-toolbar.h
   bonobo-ui-util.c
   bonobo-ui-util.h
   bonobo-ui-win32.c
   bonobo-ui-xml.c
   bonobo-ui-xml.h
   bonobo-widget.c
   bonobo-widget.h
   bonobo-window.c
   bonobo-window.h
   bonobo-wrapper.h
   bonobo-zoomable-frame.c
   bonobo-zoomable-frame.h
   bonobo-zoomable.c
   bonobo-zoomable.h
   ...i-2.0-uninstalled.pc.in
   libbonoboui-2.0.pc.in
   Makefile.am

/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 * bonobo-ui-sync.h: An abstract base for Bonobo XML / widget sync sync'ing.
 *
 * Author:
 *	Michael Meeks (michael@helixcode.com)
 *
 * Copyright 2000 Helix Code, Inc.
 */

#ifndef _BONOBO_UI_SYNC_H_
#define _BONOBO_UI_SYNC_H_

/* Internal API */
#ifdef BONOBO_UI_INTERNAL

#include <stdio.h>
#include <glib/gmacros.h>
#include <gtk/gtkcontainer.h>
#include <bonobo/bonobo-ui-node.h>

typedef struct _BonoboUISync BonoboUISync;

#include <bonobo/bonobo-ui-engine.h>

G_BEGIN_DECLS

#define BONOBO_TYPE_UI_SYNC            (bonobo_ui_sync_get_type ())
#define BONOBO_UI_SYNC(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), BONOBO_TYPE_UI_SYNC, BonoboUISync))
#define BONOBO_UI_SYNC_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), BONOBO_TYPE_UI_SYNC, BonoboUISyncClass))
#define BONOBO_IS_UI_SYNC(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BONOBO_TYPE_UI_SYNC))
#define BONOBO_IS_UI_SYNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BONOBO_TYPE_UI_SYNC))

typedef void (*BonoboUISyncStateFn)         (BonoboUISync     *sync,
					     BonoboUINode     *node,
					     BonoboUINode     *cmd_node,
					     GtkWidget        *widget,
					     GtkWidget        *parent);
	
typedef GtkWidget *(*BonoboUISyncBuildFn)   (BonoboUISync     *sync,
					     BonoboUINode     *node,
					     BonoboUINode     *cmd_node,
					     int              *pos,
					     GtkWidget        *parent);

typedef struct _BonoboUISyncPrivate BonoboUISyncPrivate;

struct _BonoboUISync {
	GObject parent;

	BonoboUIEngine *engine;
	gboolean        is_recursive;
	gboolean        has_widgets;

	BonoboUISyncPrivate *priv;
};

typedef struct {
	GObjectClass parent_class;

	BonoboUISyncStateFn sync_state;
	BonoboUISyncStateFn sync_state_placeholder;
	BonoboUISyncBuildFn build;
	BonoboUISyncBuildFn build_placeholder;

	void          (*update_root)     (BonoboUISync     *sync,
					  BonoboUINode     *root);

	void          (*remove_root)     (BonoboUISync     *sync,
					  BonoboUINode     *root);

	GList        *(*get_widgets)     (BonoboUISync     *sync,
					  BonoboUINode     *node);

	void          (*state_update)    (BonoboUISync     *sync,
					  GtkWidget        *widget,
					  const char       *new_state);
	
	gboolean      (*ignore_widget)   (BonoboUISync     *sync,
					  GtkWidget        *widget);
	
	gboolean      (*can_handle)      (BonoboUISync     *sync,
					  BonoboUINode     *node);
	
        void          (*stamp_root)      (BonoboUISync     *sync);

	GtkWidget    *(*get_attached)    (BonoboUISync     *sync,
					  GtkWidget        *widget,
					  BonoboUINode     *node);

	GtkWidget    *(*wrap_widget)     (BonoboUISync     *sync,
					  GtkWidget        *custom_widget);
} BonoboUISyncClass;

GType      bonobo_ui_sync_get_type           (void) G_GNUC_CONST;
BonoboUISync *bonobo_ui_sync_construct       (BonoboUISync     *sync,
					      BonoboUIEngine   *engine,
					      gboolean          is_recursive,
					      gboolean          has_widgets);

gboolean   bonobo_ui_sync_is_recursive       (BonoboUISync     *sync);
gboolean   bonobo_ui_sync_has_widgets        (BonoboUISync     *sync);

void       bonobo_ui_sync_remove_root        (BonoboUISync     *sync,
					      BonoboUINode     *root);
void       bonobo_ui_sync_update_root        (BonoboUISync     *sync,
					      BonoboUINode     *root);

void       bonobo_ui_sync_state              (BonoboUISync     *sync,
					      BonoboUINode     *node,
					      BonoboUINode     *cmd_node,
					      GtkWidget        *widget,
					      GtkWidget        *parent);
void       bonobo_ui_sync_state_placeholder  (BonoboUISync     *sync,
					      BonoboUINode     *node,
					      BonoboUINode     *cmd_node,
					      GtkWidget        *widget,
					      GtkWidget        *parent);

GtkWidget *bonobo_ui_sync_build              (BonoboUISync     *sync,
					      BonoboUINode     *node,
					      BonoboUINode     *cmd_node,
					      int              *pos,
					      GtkWidget        *parent);
GtkWidget *bonobo_ui_sync_build_placeholder  (BonoboUISync     *sync,
					      BonoboUINode     *node,
					      BonoboUINode     *cmd_node,
					      int              *pos,
					      GtkWidget        *parent);

gboolean   bonobo_ui_sync_ignore_widget      (BonoboUISync     *sync,
					      GtkWidget        *widget);

GList     *bonobo_ui_sync_get_widgets        (BonoboUISync     *sync,
					      BonoboUINode     *node);

void       bonobo_ui_sync_stamp_root         (BonoboUISync     *sync);

gboolean   bonobo_ui_sync_can_handle         (BonoboUISync     *sync,
					      BonoboUINode     *node);

GtkWidget *bonobo_ui_sync_get_attached       (BonoboUISync     *sync,
					      GtkWidget        *widget,
					      BonoboUINode     *node);

void       bonobo_ui_sync_state_update       (BonoboUISync     *sync,
					      GtkWidget        *widget,
					      const char       *new_state);

gboolean   bonobo_ui_sync_do_show_hide       (BonoboUISync     *sync,
					      BonoboUINode     *node,
					      BonoboUINode     *cmd_node,
					      GtkWidget        *widget);

GtkWidget *bonobo_ui_sync_wrap_widget        (BonoboUISync     *sync,
					      GtkWidget        *custom_widget);

/*
 *  These are to allow you to remove certain types of Sync
 * from a bonobo-window to allow full sub-classing of that.
 * Do not use to instantiate syncs manualy or to sub-class.
 */
GType bonobo_ui_sync_keys_get_type    (void);
GType bonobo_ui_sync_menu_get_type    (void);
GType bonobo_ui_sync_status_get_type  (void);
GType bonobo_ui_sync_toolbar_get_type (void);

G_END_DECLS

#endif /* BONOBO_UI_INTERNAL */

#endif /* _BONOBO_UI_SYNC_H_ */