navit 0.5.3-trunk
Loading...
Searching...
No Matches
osd.c File Reference
#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 osdosd_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.
 
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.
 
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.
 
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.
 
void osd_fill_with_bgcolor (struct osd_item *item)
 

Variables

struct object_func osd_func
 

Function Documentation

◆ osd_destroy()

static void osd_destroy ( struct osd osd)
static

◆ osd_evaluate_command()

static void osd_evaluate_command ( struct osd_item this,
struct navit nav 
)
static

References command_evaluate(), dbg, and lvl_debug.

Referenced by osd_std_click(), and osd_std_keypress().

◆ osd_fill_with_bgcolor()

◆ osd_get_attr()

int osd_get_attr ( struct osd osd,
enum attr_type  type,
struct attr attr,
struct attr_iter iter 
)

◆ osd_new()

◆ osd_set_attr()

int osd_set_attr ( struct osd osd,
struct attr attr 
)

◆ osd_set_keypress()

void osd_set_keypress ( struct navit nav,
struct osd_item item 
)

◆ osd_set_methods()

int osd_set_methods ( struct osd_methods in,
int  in_size,
struct osd_methods out 
)

◆ osd_set_std_attr()

◆ osd_set_std_config()

void osd_set_std_config ( struct navit nav,
struct osd_item item 
)

◆ osd_set_std_graphic()

◆ osd_std_calculate_sizes()

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).

Parameters
itemThe item whose size and position are to be calculated
wAvailable screen width in pixels
hAvailable 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().

◆ osd_std_calculate_sizes_and_redraw()

static void osd_std_calculate_sizes_and_redraw ( struct osd_item item,
struct osd_priv *  priv,
int  w,
int  h 
)
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.

Parameters
itemThe OSD item to resize and redraw
priv
wAvailable screen width in pixels (the width that corresponds to 100%)
hAvailable 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().

◆ osd_std_click()

void osd_std_click ( struct osd_item this,
struct navit nav,
int  pressed,
int  button,
struct point p 
)

◆ osd_std_config()

◆ osd_std_keypress()

static void osd_std_keypress ( struct osd_item item,
struct navit nav,
char *  key 
)
static

◆ osd_std_reconfigure()

static void osd_std_reconfigure ( struct osd_item item,
struct command_saved cs 
)
static

Configures or unconfigures an OSD item.

This method evaluates the result of the last execution of cs. 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 cs, the item's configuration state is not changed.

Parameters
itemThe OSD item to reconfigure
csThe 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().

◆ osd_std_resize()

◆ osd_wrap_point()

void osd_wrap_point ( struct point p,
struct navit nav 
)

Variable Documentation

◆ osd_func

struct object_func osd_func
Initial value:
= {
attr_osd,
}
struct osd * osd_new(struct attr *parent, struct attr **attrs)
Definition osd.c:45
int osd_set_attr(struct osd *osd, struct attr *attr)
Definition osd.c:88
static void osd_destroy(struct osd *osd)
Definition osd.c:100
int osd_get_attr(struct osd *osd, enum attr_type type, struct attr *attr, struct attr_iter *iter)
Definition osd.c:76
int navit_object_remove_attr(struct navit_object *obj, struct attr *attr)
Definition xmlconfig.c:1399
void navit_object_attr_iter_destroy(struct attr_iter *iter)
Definition xmlconfig.c:1332
struct attr_iter * navit_object_attr_iter_new(void *unused)
Definition xmlconfig.c:1328
void * navit_object_unref(struct navit_object *obj)
Definition xmlconfig.c:1313
int navit_object_add_attr(struct navit_object *obj, struct attr *attr)
Definition xmlconfig.c:1377
struct navit_object * navit_object_ref(struct navit_object *obj)
Definition xmlconfig.c:1307
struct attr_iter *(* object_func_iter_new)(void *)
Definition xmlconfig.h:60
void(* object_func_iter_destroy)(struct attr_iter *)
Definition xmlconfig.h:61
int(* object_func_remove_attr)(void *, struct attr *attr)
Definition xmlconfig.h:64
int(* object_func_init)(void *)
Definition xmlconfig.h:65
void *(* object_func_dup)(void *)
Definition xmlconfig.h:67
int(* object_func_add_attr)(void *, struct attr *attr)
Definition xmlconfig.h:63
void *(* object_func_unref)(void *)
Definition xmlconfig.h:69
void *(* object_func_new)(struct attr *parent, struct attr **attrs)
Definition xmlconfig.h:58
void(* object_func_destroy)(void *)
Definition xmlconfig.h:66
void *(* object_func_ref)(void *)
Definition xmlconfig.h:68
int(* object_func_set_attr)(void *, struct attr *attr)
Definition xmlconfig.h:62
int(* object_func_get_attr)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter)
Definition xmlconfig.h:59

Referenced by object_func_lookup(), and osd_new().