## GritsObject GritsObject — Base class for drawing operations |

## Synopsis

    #define             GRITS_SKIP_CENTER
    #define             GRITS_SKIP_HORIZON
    #define             GRITS_SKIP_LOD
    #define             GRITS_SKIP_STATE
    struct              GritsObject;
    struct              GritsObjectClass;
                        GritsState;
    #define             grits_object_center                 (object)
    void                grits_object_draw                   (GritsObject *object,
                                                             GritsOpenGL *opengl);
    gboolean            grits_object_event                  (GritsObject *object,
                                                             GdkEvent *event);
    void                grits_object_hide                   (GritsObject *object,
                                                             gboolean hidden);
    void                grits_object_pick                   (GritsObject *object,
                                                             GritsOpenGL *opengl);
    void                grits_object_queue_draw             (GritsObject *object);
    void                grits_object_set_cursor             (GritsObject *object,
                                                             GdkCursorType cursor);
    gboolean            grits_object_set_pointer            (GritsObject *object,
                                                             GdkEvent *event,
                                                             gboolean selected);

## Object Hierarchy

      GObject
       +----GritsObject
             +----GritsCallback
             +----GritsLine
             +----GritsMarker
             +----GritsPoly
             +----GritsTile
             +----GritsVolume

## Signals

      "button-press"                                   : Run Last
      "button-release"                                 : Run Last
      "clicked"                                        : Run Last
      "enter"                                          : Run Last
      "key-press"                                      : Run Last
      "key-release"                                    : Run Last
      "leave"                                          : Run Last
      "motion"                                         : Run Last

## Description

Objects in grits are things which can be added to the viewer and will be displayed to the user. Each object has information such as it's location and level of detail which are used by the viewer to determine which objects should be drawn.

Each GritsObject is also a GObject, but not every GObject in grits is a GritsObject. The "Object" part of the name is just coincidence.

## Details

### GRITS_SKIP_CENTER

    #define GRITS_SKIP_CENTER  (1<<2)

### GRITS_SKIP_HORIZON

    #define GRITS_SKIP_HORIZON (1<<1)

### GRITS_SKIP_LOD

    #define GRITS_SKIP_LOD     (1<<0)

### GRITS_SKIP_STATE

    #define GRITS_SKIP_STATE   (1<<3)

### struct GritsObject

    struct GritsObject;

### struct GritsObjectClass

    struct GritsObjectClass {
    	GObjectClass parent_class;

    	/* Move some of these to GObject? */
    	void (*draw) (GritsObject *object, GritsOpenGL *opengl);
    	void (*pick) (GritsObject *object, GritsOpenGL *opengl);
    	void (*hide) (GritsObject *object, gboolean hidden);
    };

### GritsState

    typedef struct {
    	guint picked   : 1;
    	guint selected : 1;
    	guint clicking : 6;
    } GritsState;

### grits_object_center()

    #define             grits_object_center(object)

Get the GritsPoint representing the center of an object

`object` : | The GritsObject to get the center of
Returns : | the center point

### grits_object_draw ()

    void                grits_object_draw                   (GritsObject *object,
                                                             GritsOpenGL *opengl);

Perform any OpenGL commands necessasairy to draw the object.

The GL_PROJECTION and GL_MODELVIEW matricies and GL_ALL_ATTRIB_BITS will be restored to the default state after the call to draw.

`object` : | the object
`opengl` : | the viewer the object is being displayed in

### grits_object_event ()

    gboolean            grits_object_event                  (GritsObject *object,
                                                             GdkEvent *event);

### grits_object_hide ()

    void                grits_object_hide                   (GritsObject *object,
                                                             gboolean hidden);

### grits_object_pick ()

    void                grits_object_pick                   (GritsObject *object,
                                                             GritsOpenGL *opengl);

### grits_object_queue_draw ()

    void                grits_object_queue_draw             (GritsObject *object);

Cause the widget to be redrawn on the screen at some later point

`object` : | The GritsObject that needs drawing

### grits_object_set_cursor ()

    void                grits_object_set_cursor             (GritsObject *object,
                                                             GdkCursorType cursor);

Causes the cursor to use a particular icon when located over a given object

`object` : | The GritsObject to set the cursor for
`cursor` : | The cursor to use when the object is hovered over

### grits_object_set_pointer ()

    gboolean            grits_object_set_pointer            (GritsObject *object,
                                                             GdkEvent *event,
                                                             gboolean selected);

## Signal Details

### The `"button-press"` signal

    gboolean            user_function                      (GritsObject *gritsobject,
                                                            gpointer     arg1,
                                                            gpointer     user_data)        : Run Last

`gritsobject` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"button-release"` signal

    gboolean            user_function                      (GritsObject *gritsobject,
                                                            gpointer     arg1,
                                                            gpointer     user_data)        : Run Last

`gritsobject` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"clicked"` signal

    gboolean            user_function                      (GritsObject *gritsobject,
                                                            gpointer     arg1,
                                                            gpointer     user_data)        : Run Last

`gritsobject` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"enter"` signal

    gboolean            user_function                      (GritsObject *object,
                                                            gpointer     arg1,
                                                            gpointer     user_data)      : Run Last

The ::enter signal is emitted when the pointer moves over the object

`object` : | the object.
`user_data` : | user data set when the signal handler was connected.

### The `"key-press"` signal

    gboolean            user_function                      (GritsObject *gritsobject,
                                                            gpointer     arg1,
                                                            gpointer     user_data)        : Run Last

`gritsobject` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"key-release"` signal

    gboolean            user_function                      (GritsObject *gritsobject,
                                                            gpointer     arg1,
                                                            gpointer     user_data)        : Run Last

`gritsobject` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"leave"` signal

    gboolean            user_function                      (GritsObject *gritsobject,
                                                            gpointer     arg1,
                                                            gpointer     user_data)        : Run Last

`gritsobject` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"motion"` signal

    gboolean            user_function                      (GritsObject *gritsobject,
                                                            gpointer     arg1,
                                                            gpointer     user_data)        : Run Last

`gritsobject` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.