}
+static void
+osd_evaluate_command(struct osd_item *this, struct navit *nav)
+{
+ struct attr navit;
+ navit.type=attr_navit;
+ navit.u.navit=nav;
+ dbg(0, "calling command '%s'\n", this->command);
+ command_evaluate(&navit, this->command);
+}
+
void
osd_std_click(struct osd_item *this, struct navit *nav, int pressed, int button, struct point *p)
{
if (navit_ignore_button(nav))
return;
this->pressed = pressed;
- if (pressed && this->command) {
- struct attr navit;
- navit.type=attr_navit;
- navit.u.navit=nav;
- dbg(0, "calling command '%s'\n", this->command);
- command_evaluate(&navit, this->command);
- }
+ if (pressed && this->command)
+ osd_evaluate_command(this, nav);
}
void
}
static void
+osd_std_keypress(struct osd_item *item, struct navit *nav, char *key)
+{
+#if 0
+ int i;
+ dbg(0,"key=%s\n",key);
+ for (i = 0 ; i < strlen(key) ; i++) {
+ dbg(0,"key:0x%02x\n",key[i]);
+ }
+ for (i = 0 ; i < strlen(item->accesskey) ; i++) {
+ dbg(0,"accesskey:0x%02x\n",item->accesskey[i]);
+ }
+#endif
+ if (item->accesskey && key && !strcmp(key, item->accesskey))
+ osd_evaluate_command(item, nav);
+}
+
+static void
osd_std_reconfigure(struct osd_item *item, struct command_saved *cs)
{
if (!command_saved_error(cs)) {
attr=attr_search(attrs, NULL, attr_flags);
if (attr)
item->attr_flags=attr->u.num;
+ attr=attr_search(attrs, NULL, attr_accesskey);
+ if (attr)
+ item->accesskey = g_strdup(attr->u.str);
}
void
item->resize_cb = callback_new_attr_2(callback_cast(osd_std_calculate_sizes), attr_resize, item, priv);
graphics_add_callback(navit_gr, item->resize_cb);
+ dbg(0,"accesskey %s\n",item->accesskey);
+ if (item->accesskey) {
+ item->keypress_cb=callback_new_attr_2(callback_cast(osd_std_keypress), attr_keypress, item, nav);
+ graphics_add_callback(navit_gr, item->keypress_cb);
+ }
}