#include "point.h"
#include "graphics.h"
#include "color.h"
+#include "callback.h"
#include "plugin.h"
+#include "item.h"
#include "win32_gui.h"
#include "xpm2bmp.h"
};
-void ErrorExit(LPTSTR lpszFunction)
+static void ErrorExit(LPTSTR lpszFunction)
{
// Retrieve the system error message for the last-error code
{
int xPos = LOWORD(lParam);
int yPos = HIWORD(lParam);
-
- if (gra_priv->button_callback )
- {
- struct point pt = {xPos, yPos};
- (*gra_priv->button_callback)(gra_priv->button_callback_data, updown, button, &pt);
- }
+ struct point pt = {xPos, yPos};
+ callback_list_call_attr_3(gra_priv->cbl, attr_button, (void *)updown, (void *)button, (void *)&pt);
}
static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
hdc = GetDC( hwnd );
MakeMemoryDC(hwnd, hdc );
ReleaseDC( hwnd, hdc );
- (*gra_priv->resize_callback)(gra_priv->resize_callback_data, gra_priv->width, gra_priv->height);
+ callback_list_call_attr_2(gra_priv->cbl, attr_resize, (void *)gra_priv->width, (void *)gra_priv->height);
}
break;
struct point pt = {xPos, yPos};
// printf( "WM_MOUSEMOVE: %d %d \n", xPos, yPos );
- (*gra_priv->motion_callback)(gra_priv->motion_callback_data, &pt);
+ callback_list_call_attr_1(gra_priv->cbl, attr_motion, (void *)&pt);
}
break;
static const char g_szClassName[] = "NAVGRA";
-HANDLE CreateGraphicsWindows( struct graphics_priv* gr )
+static HANDLE CreateGraphicsWindows( struct graphics_priv* gr )
{
#ifdef __CEGCC__
WNDCLASS wc;
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
- HANDLE hdl = gr->wnd_parent_handle;
GetClientRect( gr->wnd_parent_handle,&rcParent);
#ifdef __CEGCC__
gr->width = rcParent.right - rcParent.left;
gr->height = rcParent.bottom - rcParent.top;
#if defined(__CEGCC__)
- (*gr->resize_callback)(gr->resize_callback_data, gr->width, gr->height);
+ callback_list_call_attr_2(gr->cbl, attr_resize, (void *)gr->width, (void *)gr->height);
#endif
hwnd = CreateWindow( g_szClassName,
gc->line_width = w;
}
-static void gc_set_dashes(struct graphics_gc_priv *gc, unsigned char *dash_list, int n)
+static void gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, unsigned char dash_list[], int n)
{
// gdk_gc_set_dashes(gc->gc, 0, (gint8 *)dash_list, n);
// gdk_gc_set_line_attributes(gc->gc, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_ROUND, GDK_JOIN_ROUND);
}
-static void register_resize_callback(struct graphics_priv *this_, void (*callback)(void *data, int w, int h), void *data)
-{
- this_->resize_callback=callback;
- this_->resize_callback_data=data;
-}
-
-static void register_motion_callback(struct graphics_priv *this_, void (*callback)(void *data, struct point *p), void *data)
-{
- this_->motion_callback=callback;
- this_->motion_callback_data=data;
-}
-
-static void register_button_callback(struct graphics_priv *this_, void (*callback)(void *data, int press, int button, struct point *p), void *data)
-{
- this_->button_callback=callback;
- this_->button_callback_data=data;
-}
-
static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
{
RECT rcClient;
font_destroy
};
-static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size)
+static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *name, int size, int flags)
{
struct graphics_font_priv *font=g_new(struct graphics_font_priv, 1);
*meth = font_methods;
}
-void image_cache_hash_add( const char* key, struct graphics_image_priv* val_ptr)
+static void image_cache_hash_add( const char* key, struct graphics_image_priv* val_ptr)
{
if ( image_cache_hash == NULL ) {
image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal);
}
-struct graphics_image_priv* image_cache_hash_lookup( const char* key )
+static struct graphics_image_priv* image_cache_hash_lookup( const char* key )
{
struct graphics_image_priv* val_ptr = NULL;
NULL,
#endif
draw_restore,
+ NULL,
font_new,
gc_new,
background_gc,
NULL, // overlay_new,
image_new,
get_data,
- register_resize_callback,
- register_button_callback,
- register_motion_callback,
};
static struct graphics_priv * graphics_win32_drawing_area_new_helper(struct graphics_methods *meth)
return this_;
}
-struct graphics_priv* win32_graphics_new( struct navit *nav, struct graphics_methods *meth, struct attr **attrs)
+struct graphics_priv* win32_graphics_new( struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
{
struct graphics_priv* this_;
if (!event_request_system("win32","graphics_win32"))
return NULL;
this_=graphics_win32_drawing_area_new_helper(meth);
+ this_->cbl=cbl;
return this_;
}
}
static struct event_watch *
-event_win32_add_watch(int fd, int w, struct callback *cb)
+event_win32_add_watch(struct file *f, enum event_watch_cond cond, struct callback *cb)
{
dbg(0,"enter\n");
return NULL;
event_win32_remove_idle,
};
-static void
+static struct event_priv *
event_win32_new(struct event_methods *meth)
{
*meth=event_win32_methods;
+ return NULL;
}
void