summaryrefslogtreecommitdiff
path: root/navit/osd.c
diff options
context:
space:
mode:
authortegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-04-16 15:38:04 +0000
committertegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220>2011-04-16 15:38:04 +0000
commit4152d834d93d2399a85fc55efccbdb4d35a2babe (patch)
tree66e5f2e6e60ae4a484e0fc4cadcdbb7f3ec53b96 /navit/osd.c
parent9edc19f0f3501fd047e4bfcd3d293df7c17b71fb (diff)
downloadnavit-svn-4152d834d93d2399a85fc55efccbdb4d35a2babe.tar.gz
Add:osd/core:
- added the possibility to set attributes of OSDs runtime - added navit command for setting attribute of a named osd - added the possibility to set src attribute (background image) of osd buttons runtime - created "command interface" osd type to be able to access command system accessible data (for example route_status) and display it either as text or image (see Ticket #815 for details) git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4432 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/osd.c')
-rw-r--r--navit/osd.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/navit/osd.c b/navit/osd.c
index 40c56a60..690573a0 100644
--- a/navit/osd.c
+++ b/navit/osd.c
@@ -35,9 +35,12 @@ struct osd {
struct osd_priv *priv;
};
+static GHashTable *osd_hash = NULL;
+
struct osd *
osd_new(struct attr *parent, struct attr **attrs)
{
+ struct attr *attr;
struct osd *o;
struct osd_priv *(*new)(struct navit *nav, struct osd_methods *meth, struct attr **attrs);
struct attr *type=attr_search(attrs, NULL, attr_type);
@@ -49,9 +52,34 @@ osd_new(struct attr *parent, struct attr **attrs)
return NULL;
o=g_new0(struct osd, 1);
o->priv=new(parent->u.navit, &o->meth, attrs);
+
+ attr=attr_search(attrs, NULL, attr_name);
+ if (attr && attr->u.str) {
+ if(NULL == osd_hash) {
+ osd_hash = g_hash_table_new_full(g_str_hash,g_str_equal,g_free,NULL);
+ }
+ g_hash_table_insert(osd_hash, g_strdup(attr->u.str), o);
+ }
+
+
return o;
}
+struct osd*
+osd_get_osd_by_name(char *name)
+{
+ return g_hash_table_lookup(osd_hash, name);
+}
+
+int
+osd_set_attr(struct osd *osd, struct attr* attr)
+{
+ if(osd && osd->meth.set_attr) {
+ osd->meth.set_attr(osd->priv, attr);
+ }
+ return 0;
+}
+
void
osd_wrap_point(struct point *p, struct navit *nav)
{
@@ -250,8 +278,8 @@ osd_set_std_attr(struct attr **attrs, struct osd_item *item, int flags)
attr=attr_search(attrs, NULL, attr_font);
if (attr)
item->font_name = g_strdup(attr->u.str);
-}
+}
void
osd_std_config(struct osd_item *item, struct navit *navit)
{