/*
    GDAM - Geoff & Dave's Audio Mixer
    Copyright (C) 1999    Dave Benson, Geoff Matters.

    This library 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 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA

    Contact:
        daveb@ffem.org <Dave Benson>
        geoff@ugcs.caltech.edu <Geoff Matters>
*/
#ifndef __GDAM_VIEW_H_
#define __GDAM_VIEW_H_


typedef struct _GdamView GdamView;
typedef struct _GdamViewClass GdamViewClass;

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/*
 * This is the base class for all skin types.
 *
 * models maintain a list of views, which are ways
 * of viewing and modifying the underlying GdamModel.
 *
 *  [XXX. one failure is that the model pointer is a member of skin...]
 */

#include "gdammodel.h"

GtkType gdam_view_get_type();
#define GDAM_TYPE_VIEW			(gdam_view_get_type ())
#define GDAM_VIEW(obj)              (GTK_CHECK_CAST ((obj), GDAM_TYPE_VIEW, GdamView))
#define GDAM_VIEW_CLASS(klass)      (GTK_CHECK_CLASS_CAST ((klass), GDAM_TYPE_VIEW, GdamViewClass))
#define GDAM_IS_VIEW(obj)           (GTK_CHECK_TYPE ((obj), GDAM_TYPE_VIEW))
#define GDAM_IS_VIEW_CLASS(klass)   (GTK_CHECK_CLASS_TYPE ((klass), GDAM_TYPE_VIEW))

#include "gdammodel.h"

struct _GdamViewClass {
	GtkObjectClass		object_class;

	/* The xmlNode given is the node with gtk_type_name of the
	 * skin -- you should add children to it. */
	gboolean              (*make_xml)       (GdamView*    skin,
	                                         xmlNode*     parent,
						 GdamXmlInfo* info);

	/* The xmlNode is a children of the `parent' node of
	 * `make_xml'. */
	gboolean              (*parse_xml)      (GdamView*    skin,
	                                         xmlNode*     xml,
						 GdamXmlInfo* info);

	void                  (*attach_to_model)(GdamView*    skin,
	                                         GdamModel*   model);

	/* Tells skin to rebuild itself based on the underlying model. */
	void                  (*synchronize)    (GdamView*    skin);

};
struct _GdamView {
	GtkObject			object;
};

xmlNode*           gdam_view_to_xml             (GdamView*      skin,
                                                 GdamXmlInfo*   xml_info);
GdamView*          gdam_view_from_xml           (xmlNode*       node,
                                                 GdamXmlInfo*   xml_info);


gboolean           gdam_view_parse_xml          (GdamView*      skin,
                                                 xmlNode*       xmlnode,
						 GdamXmlInfo*   xml_info);
void               gdam_view_add                (GdamView*      skin,
                                                 GdamModel*     component);

void               gdam_view_synchronize(GdamView*);
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif
