navit
0.5.3-trunk
|
#include <glib.h>
#include "debug.h"
#include "plugin.h"
#include "item.h"
#include "xmlconfig.h"
#include "color.h"
#include "point.h"
#include "navit.h"
#include "graphics.h"
#include "command.h"
#include "callback.h"
#include "osd.h"
Data Structures | |
struct | osd |
Functions | |
int | osd_set_methods (struct osd_methods *in, int in_size, struct osd_methods *out) |
struct osd * | osd_new (struct attr *parent, struct attr **attrs) |
int | osd_get_attr (struct osd *osd, enum attr_type type, struct attr *attr, struct attr_iter *iter) |
int | osd_set_attr (struct osd *osd, struct attr *attr) |
static void | osd_destroy (struct osd *osd) |
void | osd_wrap_point (struct point *p, struct navit *nav) |
static void | osd_evaluate_command (struct osd_item *this, struct navit *nav) |
void | osd_std_click (struct osd_item *this, struct navit *nav, int pressed, int button, struct point *p) |
void | osd_std_resize (struct osd_item *item) |
void | osd_std_calculate_sizes (struct osd_item *item, int w, int h) |
Calculates the size and position of an OSD item. More... | |
static void | osd_std_calculate_sizes_and_redraw (struct osd_item *item, struct osd_priv *priv, int w, int h) |
Recalculates the size and position of an OSD item and triggers a redraw of the item. More... | |
static void | osd_std_keypress (struct osd_item *item, struct navit *nav, char *key) |
static void | osd_std_reconfigure (struct osd_item *item, struct command_saved *cs) |
Configures or unconfigures an OSD item. More... | |
void | osd_set_std_attr (struct attr **attrs, struct osd_item *item, int flags) |
void | osd_std_config (struct osd_item *item, struct navit *navit) |
void | osd_set_std_config (struct navit *nav, struct osd_item *item) |
void | osd_set_keypress (struct navit *nav, struct osd_item *item) |
void | osd_set_std_graphic (struct navit *nav, struct osd_item *item, struct osd_priv *priv) |
Sets up the graphics for an item. More... | |
void | osd_fill_with_bgcolor (struct osd_item *item) |
Variables | |
struct object_func | osd_func |
|
static |
References attr_list_free(), osd_methods::destroy, osd::meth, and osd::priv.
References command(), command_evaluate(), dbg, and lvl_debug.
Referenced by osd_std_click(), and osd_std_keypress().
void osd_fill_with_bgcolor | ( | struct osd_item * | item | ) |
References draw_mode_begin, graphics_draw_mode(), graphics_draw_rectangle(), and p.
Referenced by draw_aligned_osd_text(), osd_button_draw(), osd_button_init(), osd_cmd_interface_draw(), osd_compass_draw(), osd_gps_status_draw(), osd_image_init(), osd_nav_next_turn_draw(), osd_navigation_status_draw_do(), osd_odometer_draw(), osd_route_guard_draw(), osd_speed_cam_draw(), osd_speed_warner_draw(), osd_stopwatch_draw(), osd_text_draw(), and osd_volume_draw().
int osd_get_attr | ( | struct osd * | osd, |
enum attr_type | type, | ||
struct attr * | attr, | ||
struct attr_iter * | iter | ||
) |
References osd_methods::get_attr, osd::meth, navit_object_get_attr(), osd::priv, and type.
Referenced by request_osd_get_attr().
References attr_generic_prepend_attr(), attr_list_dup(), attr_list_free(), attr_search(), attr::attrs, callback_list_new(), cbl, dbg, lvl_debug, lvl_error, osd::meth, navit_object_ref(), osd_func, osd::priv, and type.
References osd::meth, navit_object_set_attr(), osd::priv, and osd_methods::set_attr.
Referenced by request_osd_set_attr().
References callback_cast, callback_new_attr_2, dbg, graphics_add_callback(), lvl_info, navit_get_graphics(), and osd_std_keypress().
Referenced by osd_button_init(), and osd_set_std_graphic().
int osd_set_methods | ( | struct osd_methods * | in, |
int | in_size, | ||
struct osd_methods * | out | ||
) |
References navit_object_set_methods().
References attr_search(), attr::attrs, attr::color, command_saved_new(), attr::num, attr::str, TRANSPARENT_BG, and attr::u.
Referenced by osd_auxmap_new(), osd_button_new(), osd_cmd_interface_new(), osd_compass_new(), osd_gps_status_new(), osd_image_new(), osd_j1850_new(), osd_nav_next_turn_new(), osd_nav_toggle_announcer_new(), osd_navigation_status_new(), osd_odometer_new(), osd_route_guard_new(), osd_scale_new(), osd_speed_cam_new(), osd_speed_warner_new(), osd_stopwatch_new(), osd_text_new(), and osd_volume_new().
References callback_cast, callback_new_attr_2, dbg, lvl_debug, navit_add_callback(), and osd_std_config().
Referenced by osd_button_init(), osd_image_init(), and osd_set_std_graphic().
Sets up the graphics for an item.
This method creates a new graphics overlay for an item and initializes its attributes (colors, font and callbacks for resize and key events).
nav | The navit object |
item | The OSD item |
priv | The struct osd_priv for the OSD item |
References padding::bottom, callback_cast, callback_new_attr_2, dbg, graphics_add_callback(), graphics_background_gc(), graphics_gc_new(), graphics_gc_set_foreground(), graphics_get_data(), graphics_named_font_new(), graphics_overlay_new(), ITEM_HAS_TEXT, padding::left, lvl_debug, navit_get_graphics(), navit_get_height(), navit_get_width(), osd_set_keypress(), osd_set_std_config(), osd_std_calculate_sizes(), osd_std_calculate_sizes_and_redraw(), padding::right, and padding::top.
Referenced by osd_button_init(), osd_cmd_interface_init(), osd_compass_init(), osd_gps_status_init(), osd_image_init(), osd_j1850_init(), osd_nav_next_turn_init(), osd_nav_toggle_announcer_init(), osd_navigation_status_init(), osd_odometer_init(), osd_route_guard_init(), osd_scale_init(), osd_stopwatch_init(), osd_text_init(), and osd_volume_init().
void osd_std_calculate_sizes | ( | struct osd_item * | item, |
int | w, | ||
int | h | ||
) |
Calculates the size and position of an OSD item.
If the geometry of the OSD item is specified relative to screen dimensions, this function will set its absolute dimensions accordingly. If relative width or relative height is set to 0% (int value is equal to ATTR_REL_RELSHIFT), object width (height) is not changed here, for button and image osds it means to derive values from the underlying image.
This method considers padding if the graphics plugin supports it (i.e. its get_data
method returns a valid pointer if "padding"
is supplied as its arument): It will offset the origin of the item by the amount of padding in the left and top edges, and will reduce w
and h
by the total amount of padding in the respective dimension to obtain the equivalent of 100%.
If the graphics driver does not support padding, none of these corrections take place (this is equivalent to 0 padding on all sides).
item | The item whose size and position are to be calculated |
w | Available screen width in pixels |
h | Available screen height in pixels |
References attr_rel2real(), ATTR_REL_RELSHIFT, padding::bottom, dbg, graphics_get_data(), padding::left, lvl_debug, lvl_warning, padding::right, and padding::top.
Referenced by osd_button_draw(), osd_button_init(), osd_scale_draw(), osd_set_std_graphic(), osd_std_calculate_sizes_and_redraw(), and set_std_osd_attr().
|
static |
Recalculates the size and position of an OSD item and triggers a redraw of the item.
This is a callback function that can be stored in the resize_cb
member of an OSD item.
item | The OSD item to resize and redraw |
priv | |
w | Available screen width in pixels (the width that corresponds to 100%) |
h | Available screen height in pixels (the height that corresponds to 100%) |
References item::meth, navit_get_attr(), osd_std_calculate_sizes(), osd_std_resize(), attr::u, and attr::vehicle.
Referenced by osd_set_std_graphic().
void osd_std_click | ( | struct osd_item * | this, |
struct navit * | nav, | ||
int | pressed, | ||
int | button, | ||
struct point * | p | ||
) |
References command(), configured, navit_ignore_button(), osd_evaluate_command(), osd_wrap_point(), p, point::x, and point::y.
Referenced by osd_button_init(), osd_cmd_interface_init(), osd_compass_init(), osd_nav_next_turn_init(), osd_nav_toggle_announcer_init(), and osd_text_init().
References callback_cast, callback_new_1, command_error_to_text(), command_saved_error(), command_saved_get_int(), command_saved_set_cb(), dbg, DISABLE_OVERLAY, err(), graphics_overlay_disable(), lvl_debug, lvl_error, navit_get_attr(), attr::num, osd_std_reconfigure(), and attr::u.
Referenced by osd_set_std_config().
References dbg, graphics_is_disabled(), key, lvl_debug, and osd_evaluate_command().
Referenced by osd_set_keypress().
|
static |
Configures or unconfigures an OSD item.
This method evaluates the result of the last execution of
. If it evaluates to true, the item is configured, else it is unconfigured. (A configured item is displayed on the screen and can respond to user input, an unconfigured item is invisible and cannot receive user input.)
If an error occurred during evaluation of
, the item's configuration state is not changed.
item | The OSD item to reconfigure |
cs | The command to evaluate |
References command_error_to_text(), command_saved_error(), command_saved_get_int(), dbg, DISABLE_OVERLAY, err(), graphics_overlay_disable(), lvl_debug, and lvl_error.
Referenced by osd_std_config().
void osd_std_resize | ( | struct osd_item * | item | ) |
References graphics_overlay_resize().
Referenced by draw_aligned_osd_text(), osd_std_calculate_sizes_and_redraw(), osd_text_draw(), and set_std_osd_attr().
References navit_get_height(), navit_get_width(), and p.
Referenced by osd_odometer_click(), osd_speed_warner_click(), osd_std_click(), and osd_stopwatch_click().
struct object_func osd_func |
Referenced by object_func_lookup(), and osd_new().