#include <glib.h>
#include <string.h>
#include "debug.h"
+#include "callback.h"
#include "gui.h"
#include "menu.h"
#include "data_window.h"
struct gui_methods meth;
struct gui_priv *priv;
struct attr **attrs;
+ struct attr parent;
};
struct gui *
{
struct gui *this_;
struct attr *type_attr;
- struct gui_priv *(*guitype_new)(struct navit *nav, struct gui_methods *meth, struct attr **attrs);
+ struct gui_priv *(*guitype_new)(struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui);
+ struct attr cbl;
if (! (type_attr=attr_search(attrs, NULL, attr_type))) {
return NULL;
}
return NULL;
this_=g_new0(struct gui, 1);
- this_->priv=guitype_new(parent->u.navit, &this_->meth, attrs);
this_->attrs=attr_list_dup(attrs);
+ cbl.type=attr_callback_list;
+ cbl.u.callback_list=callback_list_new();
+ this_->attrs=attr_generic_add_attr(this_->attrs, &cbl);
+ this_->priv=guitype_new(parent->u.navit, &this_->meth, this_->attrs, this_);
+ this_->parent=*parent;
return this_;
}
int
gui_get_attr(struct gui *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
{
- return attr_generic_get_attr(this_->attrs, type, attr, iter);
+ int ret;
+ if (this_->meth.get_attr) {
+ ret=this_->meth.get_attr(this_->priv, type, attr);
+ if (ret)
+ return ret;
+ }
+ if (type == this_->parent.type) {
+ *attr=this_->parent;
+ return 1;
+ }
+ return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
+}
+
+
+int
+gui_set_attr(struct gui *this_, struct attr *attr)
+{
+ int ret=1;
+ if (this_->meth.set_attr)
+ ret=this_->meth.set_attr(this_->priv, attr);
+ if (ret == 1)
+ this_->attrs=attr_generic_set_attr(this_->attrs, attr);
+ return ret != 0;
+}
+
+int
+gui_add_attr(struct gui *this_, struct attr *attr)
+{
+ int ret=0;
+ if (this_->meth.add_attr)
+ ret=this_->meth.add_attr(this_->priv, attr);
+ return ret;
}
struct menu *
return this_->meth.set_graphics(this_->priv, gra);
}
+void
+gui_disable_suspend(struct gui *this_)
+{
+ if (this_->meth.disable_suspend)
+ this_->meth.disable_suspend(this_->priv);
+}
+
int
gui_has_main_loop(struct gui *this_)
{