X-Git-Url: http://pileus.org/git/?p=grits;a=blobdiff_plain;f=src%2Fobjects%2Fgrits-object.h;h=728ac720d9165bd2658ca2121091e8751906d04a;hp=dcacd9dbe5fd459c3f5b6112222bd170c8e487b2;hb=d55c77bbf477e582a8525ac831ad97b035b8185d;hpb=3ea7566fadf5490c46e04cb3a2a6cc8e02ac05e6 diff --git a/src/objects/grits-object.h b/src/objects/grits-object.h index dcacd9d..728ac72 100644 --- a/src/objects/grits-object.h +++ b/src/objects/grits-object.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2010 Andy Spencer + * Copyright (C) 2009-2011 Andy Spencer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,6 +36,16 @@ #define GRITS_SKIP_CENTER (1<<2) #define GRITS_SKIP_STATE (1<<3) +/* Mouse move threshold for clicking */ +#define GRITS_CLICK_THRESHOLD 8 + +/* Picking states */ +typedef struct { + guint picked : 1; + guint selected : 1; + guint clicking : 6; +} GritsState; + typedef struct _GritsObject GritsObject; typedef struct _GritsObjectClass GritsObjectClass; @@ -48,6 +58,9 @@ struct _GritsObject { gboolean hidden; // If true, the object will not be drawn gdouble lod; // Level of detail, used to hide small objects guint32 skip; // Bit mask of safe operations + + GritsState state; // Internal, used for picking + GdkCursor *cursor; // Internal, cached cursor }; struct _GritsObjectClass { @@ -55,6 +68,8 @@ struct _GritsObjectClass { /* Move some of these to GObject? */ void (*draw) (GritsObject *object, GritsOpenGL *opengl); + void (*pick) (GritsObject *object, GritsOpenGL *opengl); + void (*hide) (GritsObject *object, gboolean hidden); }; GType grits_object_get_type(void); @@ -62,6 +77,13 @@ GType grits_object_get_type(void); /* Implemented by sub-classes */ void grits_object_draw(GritsObject *object, GritsOpenGL *opengl); +void grits_object_hide(GritsObject *object, gboolean hidden); + +/* Interal, used by grits_opengl */ +void grits_object_pick(GritsObject *object, GritsOpenGL *opengl); +gboolean grits_object_set_pointer(GritsObject *object, GdkEvent *event, gboolean selected); +gboolean grits_object_event(GritsObject *object, GdkEvent *event); + /** * grits_object_queue_draw: * @object: The #GritsObject that needs drawing @@ -70,6 +92,15 @@ void grits_object_draw(GritsObject *object, GritsOpenGL *opengl); */ void grits_object_queue_draw(GritsObject *object); +/** + * grits_object_set_cursor: + * @object: The #GritsObject to set the cursor for + * @cursor: The cursor to use when the object is hovered over + * + * Causes the cursor to use a particular icon when located over a given object + */ +void grits_object_set_cursor(GritsObject *object, GdkCursorType cursor); + /** * grits_object_center: * @object: The #GritsObject to get the center of