/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */

#ifndef __KZ_RUBY_EXT_H__
#define __KZ_RUBY_EXT_H__

#include <rbgtk.h>

#undef PACKAGE_NAME
#undef PACKAGE_TARNAME
#undef PACKAGE_STRING
#undef PACKAGE_VERSION

#include "kz-app.h"
#include "kz-window.h"
#include "kz-notebook.h"
#include "kz-statusbar.h"
#include "kz-downloader.h"
#include "kz-downloader-group.h"
#include "kz-enum-types.h"
#include "kz-embed-event.h"

#define RVAL2DLGRP(obj)    (KZ_DOWNLOADER_GROUP(RVAL2GOBJ(obj)))
#define RVAL2DL(obj)       (KZ_DOWNLOADER(RVAL2GOBJ(obj)))
#define EVENTMOUSE2RVAL(obj) \
  (BOXED2RVAL(obj, KZ_TYPE_EMBED_EVENT_MOUSE))

#define RVAL2GTKWIDGET(obj) (GTK_WIDGET(RVAL2GOBJ(obj)))

#define RVAL2KZAPP(obj) (KZ_APP(RVAL2GOBJ(obj)))
#define RVAL2KZWIN(obj) (KZ_WINDOW(RVAL2GOBJ(obj)))
#define RVAL2KZNB(obj) (KZ_NOTEBOOK(RVAL2GOBJ(obj)))
#define RVAL2KZEMB(obj) (KZ_EMBED(RVAL2GOBJ(obj)))
#define RVAL2KZTL(obj) (KZ_TAB_LABEL(RVAL2GOBJ(obj)))

#ifndef G_CHILD_ADD
#define G_CHILD_ADD(self, child) /* hide when old Ruby-GNOME2 */
#endif
#ifndef RVAL2CSTR2
#  define RVAL2CSTR2(v) (NIL_P(v) ? NULL : StringValuePtr(v))
#endif

#define KZ_RB_GET_APP (kz_rb_get_app())

extern KzApp *kz_rb_get_app(void);

extern void Init_kz_rb_app(VALUE mKz, KzApp *app);
extern void Init_kz_rb_window(VALUE mKz);
extern void Init_kz_rb_notebook(VALUE mKz);
extern void Init_kz_rb_statusbar(VALUE mKz);
extern void Init_kz_rb_embed(VALUE mKz);
extern void Init_kz_rb_embed_event(VALUE mKz);
extern void Init_kz_rb_conf(VALUE mKz);
extern void Init_kz_rb_downloader(VALUE mKz);
extern void Init_kz_rb_downloader_group(VALUE mKz);
extern void Init_kz_rb_bookmark(VALUE mKz);
extern void Init_kz_rb_sidebar(VALUE mKz);

extern void kz_rb_setup_sidebar(KzWindow *kz);

#endif /* __KZ_RUBY_EXT_H__ */
