//# Comment:
//# Authors: Martin Schaller (04/2008)
//##############################################################################################################
+void graphics_overlay_disable(struct graphics *this_, int disable)
+{
+ if (this_->meth.overlay_disable)
+ this_->meth.overlay_disable(this_->priv, disable);
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
void graphics_draw_image(struct graphics *this_, struct graphics_gc *gc, struct point *p, struct graphics_image *img)
{
this_->meth.draw_image(this_->priv, gc->priv, p, img->priv);
void (*register_motion_callback)(struct graphics_priv *gr, void (*callback)(void *data, struct point *p), void *data);
void (*image_free)(struct graphics_priv *gr, struct graphics_image_priv *priv);
void (*get_text_bbox)(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret);
+ void (*overlay_disable)(struct graphics_priv *gr, int disable);
+ void (*register_key_callback)(struct graphics_priv *gr, void (*callback)(void *data, struct point *p), void *data);
};
void graphics_draw_rectangle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int w, int h);
void graphics_draw_text(struct graphics *this_, struct graphics_gc *gc1, struct graphics_gc *gc2, struct graphics_font *font, char *text, struct point *p, int dx, int dy);
void graphics_get_text_bbox(struct graphics *this_, struct graphics_font *font, char *text, int dx, int dy, struct point *ret);
+void graphics_overlay_disable(struct graphics *this_, int disable);
void graphics_draw_image(struct graphics *this_, struct graphics_gc *gc, struct point *p, struct graphics_image *img);
void display_add(struct displaylist *displaylist, struct item *item, int count, struct point *pnt, char *label);
int graphics_ready(struct graphics *this_);
#include "graphics.h"
#include "color.h"
#include "item.h"
+#include "window.h"
#include "plugin.h"
struct graphics_priv {
int button_timeout;
GtkWidget *widget;
GtkWidget *win;
+ struct window window;
GdkDrawable *drawable;
GdkDrawable *background;
int background_ready;
int win_h;
int library_init;
int visible;
+ int overlay_disabled;
struct graphics_priv *parent;
struct graphics_priv *overlays;
struct graphics_priv *next;
void *motion_callback_data;
void (*button_callback)(void *data, int press, int button, struct point *p);
void *button_callback_data;
+ void (*key_callback)(void *data, int key);
+ void *key_callback_data;
};
+
struct graphics_font_priv {
FT_Face face;
};
if (! parent->drawable)
return;
-
+ if (parent->overlay_disabled || overlay->overlay_disabled)
+ return;
w=overlay->width;
if (w < 0)
w+=parent->width;
static struct graphics_priv *graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth);
+static void
+overlay_disable(struct graphics_priv *gr, int disabled)
+{
+ gr->overlay_disabled=disabled;
+}
+
static struct graphics_priv *
overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h)
{
static char **gtk_argv={NULL};
+static int
+graphics_gtk_drawing_area_fullscreen(struct window *w, int on)
+{
+ struct graphics_priv *gr=w->priv;
+ if (on)
+ gtk_window_fullscreen(GTK_WINDOW(gr->win));
+ else
+ gtk_window_unfullscreen(GTK_WINDOW(gr->win));
+ return 1;
+}
+
static void *
get_data(struct graphics_priv *this, char *type)
{
gtk_widget_realize(this->win);
gtk_container_add(GTK_CONTAINER(this->win), this->widget);
gtk_widget_show_all(this->win);
- return this->win;
+ this->window.fullscreen=graphics_gtk_drawing_area_fullscreen;
+ this->window.priv=this;
+ return &this->window;
}
return NULL;
}
this->button_callback_data=data;
}
+static void
+register_key_callback(struct graphics_priv *this, void (*callback)(void *data, int press, int button, struct point *p), void *data)
+{
+ this->key_callback=callback;
+ this->key_callback_data=data;
+}
+
static struct graphics_methods graphics_methods = {
graphics_destroy,
draw_mode,
register_motion_callback,
image_free,
get_text_bbox,
+ overlay_disable,
+ register_key_callback,
};
static struct graphics_priv *
#include "layout.h"
#include "callback.h"
#include "vehicle.h"
+#include "window.h"
#include "config.h"
#define STATE_VISIBLE 1
//##############################################################################################################
struct gui_priv {
struct navit *nav;
+ struct window *win;
struct graphics *gra;
struct graphics_gc *background;
struct graphics_gc *background2;
struct graphics_gc *foreground;
int spacing;
int font_size;
+ int fullscreen;
struct graphics_font *font;
int icon_xs, icon_s, icon_l;
int pressed;
gui_internal_menu_render(this);
}
+static void
+gui_internal_cmd_fullscreen(struct gui_priv *this, struct widget *wm)
+{
+ this->fullscreen=!this->fullscreen;
+ this->win->fullscreen(this->win, this->fullscreen);
+}
+
static void
gui_internal_cmd_display(struct gui_priv *this, struct widget *wm)
gui_internal_button_new_with_callback(this, "Layout",
image_new_l(this, "gui_display"), gravity_center|orientation_vertical,
gui_internal_cmd_layout, NULL));
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, "Fullscreen",
+ image_new_l(this, "gui_display"), gravity_center|orientation_vertical,
+ gui_internal_cmd_fullscreen, NULL));
gui_internal_menu_render(this);
}
if (!navit_handle_button(this->nav, pressed, button, p, NULL) || button >=4) // Maybe there's a better way to do this
return;
navit_block(this->nav, 1);
+ graphics_overlay_disable(gra, 1);
// draw menu
this->root.p.x=0;
this->root.p.y=0;
gui_internal_highlight(this, NULL);
graphics_draw_mode(gra, draw_mode_end);
if (! this->root.children) {
+ graphics_overlay_disable(gra, 0);
if (!navit_block(this->nav, 0)) {
if (this->redraw)
navit_draw(this->nav);
//##############################################################################################################
static int gui_internal_set_graphics(struct gui_priv *this, struct graphics *gra)
{
- void *graphics;
+ struct window *win;
#if 0
struct color cb={0x7fff,0x7fff,0x7fff,0xffff};
#endif
struct color cf={0xbfff,0xbfff,0xbfff,0xffff};
struct transformation *trans=navit_get_trans(this->nav);
- graphics=graphics_get_data(gra, "window");
- if (! graphics)
+ win=graphics_get_data(gra, "window");
+ if (! win)
return 1;
this->gra=gra;
+ this->win=win;
transform_get_size(trans, &this->root.w, &this->root.h);
graphics_register_resize_callback(gra, gui_internal_resize, this);
graphics_register_button_callback(gra, gui_internal_button, this);