Blame gdk/gdkcursor.c

Packit 98cdb6
/* GDK - The GIMP Drawing Kit
Packit 98cdb6
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
Packit 98cdb6
 *
Packit 98cdb6
 * This library is free software; you can redistribute it and/or
Packit 98cdb6
 * modify it under the terms of the GNU Lesser General Public
Packit 98cdb6
 * License as published by the Free Software Foundation; either
Packit 98cdb6
 * version 2 of the License, or (at your option) any later version.
Packit 98cdb6
 *
Packit 98cdb6
 * This library is distributed in the hope that it will be useful,
Packit 98cdb6
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 98cdb6
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 98cdb6
 * Lesser General Public License for more details.
Packit 98cdb6
 *
Packit 98cdb6
 * You should have received a copy of the GNU Lesser General Public
Packit 98cdb6
 * License along with this library; if not, write to the
Packit 98cdb6
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit 98cdb6
 * Boston, MA 02111-1307, USA.
Packit 98cdb6
 */
Packit 98cdb6
Packit 98cdb6
/*
Packit 98cdb6
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
Packit 98cdb6
 * file for a list of people on the GTK+ Team.  See the ChangeLog
Packit 98cdb6
 * files for a list of changes.  These files are distributed with
Packit 98cdb6
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
Packit 98cdb6
 */
Packit 98cdb6
Packit 98cdb6
#include "config.h"
Packit 98cdb6
#include "gdkcursor.h"
Packit 98cdb6
#include "gdkdisplay.h"
Packit 98cdb6
#include "gdkinternals.h"
Packit 98cdb6
#include "gdkalias.h"
Packit 98cdb6
Packit 98cdb6
GType
Packit 98cdb6
gdk_cursor_get_type (void)
Packit 98cdb6
{
Packit 98cdb6
  static GType our_type = 0;
Packit 98cdb6
  
Packit 98cdb6
  if (our_type == 0)
Packit 98cdb6
    our_type = g_boxed_type_register_static (g_intern_static_string ("GdkCursor"),
Packit 98cdb6
					     (GBoxedCopyFunc)gdk_cursor_ref,
Packit 98cdb6
					     (GBoxedFreeFunc)gdk_cursor_unref);
Packit 98cdb6
  return our_type;
Packit 98cdb6
}
Packit 98cdb6
Packit 98cdb6
/**
Packit 98cdb6
 * gdk_cursor_ref:
Packit 98cdb6
 * @cursor: a #GdkCursor
Packit 98cdb6
 * 
Packit 98cdb6
 * Adds a reference to @cursor.
Packit 98cdb6
 * 
Packit 98cdb6
 * Return value: (transfer full): Same @cursor that was passed in
Packit 98cdb6
 **/
Packit 98cdb6
GdkCursor*
Packit 98cdb6
gdk_cursor_ref (GdkCursor *cursor)
Packit 98cdb6
{
Packit 98cdb6
  g_return_val_if_fail (cursor != NULL, NULL);
Packit 98cdb6
  g_return_val_if_fail (cursor->ref_count > 0, NULL);
Packit 98cdb6
Packit 98cdb6
  cursor->ref_count += 1;
Packit 98cdb6
Packit 98cdb6
  return cursor;
Packit 98cdb6
}
Packit 98cdb6
Packit 98cdb6
/**
Packit 98cdb6
 * gdk_cursor_unref:
Packit 98cdb6
 * @cursor: a #GdkCursor
Packit 98cdb6
 *
Packit 98cdb6
 * Removes a reference from @cursor, deallocating the cursor
Packit 98cdb6
 * if no references remain.
Packit 98cdb6
 * 
Packit 98cdb6
 **/
Packit 98cdb6
void
Packit 98cdb6
gdk_cursor_unref (GdkCursor *cursor)
Packit 98cdb6
{
Packit 98cdb6
  g_return_if_fail (cursor != NULL);
Packit 98cdb6
  g_return_if_fail (cursor->ref_count > 0);
Packit 98cdb6
Packit 98cdb6
  cursor->ref_count -= 1;
Packit 98cdb6
Packit 98cdb6
  if (cursor->ref_count == 0)
Packit 98cdb6
    _gdk_cursor_destroy (cursor);
Packit 98cdb6
}
Packit 98cdb6
Packit 98cdb6
/**
Packit 98cdb6
 * gdk_cursor_new:
Packit 98cdb6
 * @cursor_type: cursor to create
Packit 98cdb6
 * 
Packit 98cdb6
 * Creates a new cursor from the set of builtin cursors for the default display.
Packit 98cdb6
 * See gdk_cursor_new_for_display().
Packit 98cdb6
 *
Packit 98cdb6
 * To make the cursor invisible, use %GDK_BLANK_CURSOR.
Packit 98cdb6
 * 
Packit 98cdb6
 * Return value: a new #GdkCursor
Packit 98cdb6
 **/
Packit 98cdb6
GdkCursor*
Packit 98cdb6
gdk_cursor_new (GdkCursorType cursor_type)
Packit 98cdb6
{
Packit 98cdb6
  return gdk_cursor_new_for_display (gdk_display_get_default(), cursor_type);
Packit 98cdb6
}
Packit 98cdb6
Packit 98cdb6
/**
Packit 98cdb6
 * gdk_cursor_get_cursor_type:
Packit 98cdb6
 * @cursor:  a #GdkCursor
Packit 98cdb6
 *
Packit 98cdb6
 * Returns the cursor type for this cursor.
Packit 98cdb6
 *
Packit 98cdb6
 * Return value: a #GdkCursorType
Packit 98cdb6
 *
Packit 98cdb6
 * Since: 2.22
Packit 98cdb6
 **/
Packit 98cdb6
GdkCursorType
Packit 98cdb6
gdk_cursor_get_cursor_type (GdkCursor *cursor)
Packit 98cdb6
{
Packit 98cdb6
  g_return_val_if_fail (cursor != NULL, GDK_BLANK_CURSOR);
Packit 98cdb6
  return cursor->type;
Packit 98cdb6
}
Packit 98cdb6
Packit 98cdb6
#define __GDK_CURSOR_C__
Packit 98cdb6
#include "gdkaliasdef.c"