navit  0.5.3-trunk
graphics_cocoa.m File Reference
#include <glib.h>
#include "config.h"
#include "config_.h"
#include "debug.h"
#include "plugin.h"
#include "point.h"
#include "window.h"
#include "graphics.h"
#include "event.h"
#include "item.h"
#include "callback.h"
#include "color.h"
#include <iconv.h>
#import <Cocoa/Cocoa.h>

Data Structures

class  NavitView
 
struct  graphics_priv
 
struct  graphics_gc_priv
 
struct  graphics_font_priv
 
class  NavitViewController
 
class  NavitAppDelegate
 
class  NavitTimer
 
struct  event_idle
 

Macros

#define USE_UIKIT   0
 
#define UIView   NSView
 
#define UIViewController   NSViewController
 
#define UIApplicationDelegate   NSApplicationDelegate
 
#define UIWindow   NSWindow
 
#define UIApplication   NSApplication
 
#define UIApplicationMain(a, b, c, d)   NSApplicationMain(a,b)
 
#define UIScreen   NSScreen
 
#define UIEvent   NSEvent
 
#define applicationFrame   frame
 
#define REVERSE_Y   1
 

Functions

CGContextRef current_context (void)
 
static void draw_mode (struct graphics_priv *gr, enum draw_mode_num mode)
 
static void draw_lines (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
 
static void draw_polygon (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
 
static void draw_rectangle (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
 
static void draw_text (struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
 
static void draw_image (struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
 
static void font_destroy (struct graphics_font_priv *font)
 
static void draw_drag (struct graphics_priv *gr, struct point *p)
 
static struct graphics_font_privfont_new (struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags)
 
static void gc_destroy (struct graphics_gc_priv *gc)
 
static void gc_set_linewidth (struct graphics_gc_priv *gc, int w)
 
static void gc_set_dashes (struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
 
static void gc_set_foreground (struct graphics_gc_priv *gc, struct color *c)
 
static void gc_set_background (struct graphics_gc_priv *gc, struct color *c)
 
static struct graphics_gc_privgc_new (struct graphics_priv *gr, struct graphics_gc_methods *meth)
 
static void background_gc (struct graphics_priv *gr, struct graphics_gc_priv *gc)
 
static struct graphics_privoverlay_new (struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound)
 
static struct graphics_image_privimage_new (struct graphics_priv *gra, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation)
 
static void * get_data (struct graphics_priv *this, const char *type)
 
static void image_free (struct graphics_priv *gr, struct graphics_image_priv *priv)
 
static void get_text_bbox (struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate)
 
static void overlay_disable (struct graphics_priv *gr, int disabled)
 
struct graphics_privgraphics_cocoa_new (struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
 
static void event_cocoa_main_loop_run (void)
 
static struct event_timeoutevent_cocoa_add_timeout (int timeout, int multi, struct callback *cb)
 
static void event_cocoa_remove_timeout (struct event_timeout *ev)
 
static struct event_idleevent_cocoa_add_idle (int priority, struct callback *cb)
 
static void event_cocoa_remove_idle (struct event_idle *ev)
 
static struct event_privevent_cocoa_new (struct event_methods *meth)
 
void plugin_init (void)
 

Variables

static struct graphics_privglobal_graphics_cocoa
 
iconv_t utf8_macosroman
 
static struct graphics_font_methods font_methods
 
static struct graphics_gc_methods gc_methods
 
static struct graphics_methods graphics_methods
 
static struct event_methods event_cocoa_methods
 

Macro Definition Documentation

◆ applicationFrame

#define applicationFrame   frame

◆ REVERSE_Y

#define REVERSE_Y   1

◆ UIApplication

#define UIApplication   NSApplication

◆ UIApplicationDelegate

#define UIApplicationDelegate   NSApplicationDelegate

◆ UIApplicationMain

#define UIApplicationMain (   a,
  b,
  c,
 
)    NSApplicationMain(a,b)

◆ UIEvent

#define UIEvent   NSEvent

◆ UIScreen

#define UIScreen   NSScreen

◆ UIView

#define UIView   NSView

◆ UIViewController

#define UIViewController   NSViewController

◆ UIWindow

#define UIWindow   NSWindow

◆ USE_UIKIT

#define USE_UIKIT   0

Function Documentation

◆ background_gc()

static void background_gc ( struct graphics_priv gr,
struct graphics_gc_priv gc 
)
static

◆ current_context()

CGContextRef current_context ( void  )

◆ draw_drag()

static void draw_drag ( struct graphics_priv gr,
struct point p 
)
static

◆ draw_image()

static void draw_image ( struct graphics_priv gr,
struct graphics_gc_priv fg,
struct point p,
struct graphics_image_priv img 
)
static

References graphics_priv::layer_context, and p.

◆ draw_lines()

static void draw_lines ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  count 
)
static

◆ draw_mode()

static void draw_mode ( struct graphics_priv gr,
enum draw_mode_num  mode 
)
static

◆ draw_polygon()

static void draw_polygon ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  count 
)
static

◆ draw_rectangle()

static void draw_rectangle ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  w,
int  h 
)
static

◆ draw_text()

static void draw_text ( struct graphics_priv gr,
struct graphics_gc_priv fg,
struct graphics_gc_priv bg,
struct graphics_font_priv font,
char *  text,
struct point p,
int  dx,
int  dy 
)
static

◆ event_cocoa_add_idle()

static struct event_idle* event_cocoa_add_idle ( int  priority,
struct callback cb 
)
static

◆ event_cocoa_add_timeout()

static struct event_timeout* event_cocoa_add_timeout ( int  timeout,
int  multi,
struct callback cb 
)
static

◆ event_cocoa_main_loop_run()

static void event_cocoa_main_loop_run ( void  )
static

◆ event_cocoa_new()

static struct event_priv* event_cocoa_new ( struct event_methods meth)
static

References dbg, and event_cocoa_methods.

Referenced by plugin_init().

◆ event_cocoa_remove_idle()

static void event_cocoa_remove_idle ( struct event_idle ev)
static

◆ event_cocoa_remove_timeout()

static void event_cocoa_remove_timeout ( struct event_timeout ev)
static

◆ font_destroy()

static void font_destroy ( struct graphics_font_priv font)
static

◆ font_new()

static struct graphics_font_priv* font_new ( struct graphics_priv gr,
struct graphics_font_methods meth,
char *  font,
int  size,
int  flags 
)
static

◆ gc_destroy()

static void gc_destroy ( struct graphics_gc_priv gc)
static

◆ gc_new()

static struct graphics_gc_priv* gc_new ( struct graphics_priv gr,
struct graphics_gc_methods meth 
)
static

References gc_methods, and graphics_gc_priv::w.

◆ gc_set_background()

static void gc_set_background ( struct graphics_gc_priv gc,
struct color c 
)
static

◆ gc_set_dashes()

static void gc_set_dashes ( struct graphics_gc_priv gc,
int  w,
int  offset,
unsigned char *  dash_list,
int  n 
)
static

◆ gc_set_foreground()

static void gc_set_foreground ( struct graphics_gc_priv gc,
struct color c 
)
static

References c, and graphics_gc_priv::rgba.

◆ gc_set_linewidth()

static void gc_set_linewidth ( struct graphics_gc_priv gc,
int  w 
)
static

References graphics_gc_priv::w.

◆ get_data()

static void* get_data ( struct graphics_priv this,
const char *  type 
)
static

References dbg, and type.

◆ get_text_bbox()

static void get_text_bbox ( struct graphics_priv gr,
struct graphics_font_priv font,
char *  text,
int  dx,
int  dy,
struct point ret,
int  estimate 
)
static

◆ graphics_cocoa_new()

struct graphics_priv* graphics_cocoa_new ( struct navit nav,
struct graphics_methods meth,
struct attr **  attrs,
struct callback_list cbl 
)

◆ image_free()

static void image_free ( struct graphics_priv gr,
struct graphics_image_priv priv 
)
static

◆ image_new()

static struct graphics_image_priv* image_new ( struct graphics_priv gra,
struct graphics_image_methods meth,
char *  path,
int *  w,
int *  h,
struct point hot,
int  rotation 
)
static

◆ overlay_disable()

static void overlay_disable ( struct graphics_priv gr,
int  disabled 
)
static

◆ overlay_new()

static struct graphics_priv * overlay_new ( struct graphics_priv gr,
struct graphics_methods meth,
struct point p,
int  w,
int  h,
int  wraparound 
)
static

◆ plugin_init()

void plugin_init ( void  )

Variable Documentation

◆ event_cocoa_methods

struct event_methods event_cocoa_methods
static
Initial value:
= {
NULL,
NULL,
NULL,
NULL,
}
static void event_cocoa_main_loop_run(void)
Definition: graphics_cocoa.m:683
static void event_cocoa_remove_idle(struct event_idle *ev)
Definition: graphics_cocoa.m:769
static struct event_timeout * event_cocoa_add_timeout(int timeout, int multi, struct callback *cb)
Definition: graphics_cocoa.m:737
static void event_cocoa_remove_timeout(struct event_timeout *ev)
Definition: graphics_cocoa.m:748
static struct event_idle * event_cocoa_add_idle(int priority, struct callback *cb)
Definition: graphics_cocoa.m:758

Referenced by event_cocoa_new().

◆ font_methods

struct graphics_font_methods font_methods
static
Initial value:
= {
}
static void font_destroy(struct graphics_font_priv *font)
Definition: graphics_cocoa.m:470

Referenced by font_new().

◆ gc_methods

struct graphics_gc_methods gc_methods
static
Initial value:
= {
}
static void gc_destroy(struct graphics_gc_priv *gc)
Definition: graphics_cocoa.m:505
static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
Definition: graphics_cocoa.m:522
static void gc_set_background(struct graphics_gc_priv *gc, struct color *c)
Definition: graphics_cocoa.m:531
static void gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
Definition: graphics_cocoa.m:517
static void gc_set_linewidth(struct graphics_gc_priv *gc, int w)
Definition: graphics_cocoa.m:511

Referenced by gc_new().

◆ global_graphics_cocoa

struct graphics_priv * global_graphics_cocoa
static

Referenced by graphics_cocoa_new().

◆ graphics_methods

Initial value:
= {
NULL,
NULL,
NULL,
NULL,
NULL,
}
static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound)
Definition: graphics_cocoa.m:652
static void draw_drag(struct graphics_priv *gr, struct point *p)
Definition: graphics_cocoa.m:480
static void overlay_disable(struct graphics_priv *gr, int disabled)
Definition: graphics_cocoa.m:621
static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
Definition: graphics_cocoa.m:426
static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
Definition: graphics_cocoa.m:457
static void * get_data(struct graphics_priv *this, const char *type)
Definition: graphics_cocoa.m:587
static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
Definition: graphics_cocoa.m:439
static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
Definition: graphics_cocoa.m:554
static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
Definition: graphics_cocoa.m:393
static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate)
Definition: graphics_cocoa.m:602
static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
Definition: graphics_cocoa.m:378
static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
Definition: graphics_cocoa.m:411
static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv)
Definition: graphics_cocoa.m:596
static struct graphics_gc_priv * gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
Definition: graphics_cocoa.m:543
static struct graphics_font_priv * font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags)
Definition: graphics_cocoa.m:494
static struct graphics_image_priv * image_new(struct graphics_priv *gra, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation)
Definition: graphics_cocoa.m:563

Referenced by graphics_cocoa_new(), and overlay_new().

◆ utf8_macosroman

iconv_t utf8_macosroman

Referenced by draw_text().