Blame gtk/gtkcelleditable.c

Packit 98cdb6
/* gtkcelleditable.c
Packit 98cdb6
 * Copyright (C) 2000  Red Hat, Inc.,  Jonathan Blandford <jrb@redhat.com>
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 Library 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
 * Library General Public License for more details.
Packit 98cdb6
 *
Packit 98cdb6
 * You should have received a copy of the GNU Library 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
#include "config.h"
Packit 98cdb6
#include "gtkcelleditable.h"
Packit 98cdb6
#include "gtkmarshalers.h"
Packit 98cdb6
#include "gtkprivate.h"
Packit 98cdb6
#include "gtkintl.h"
Packit 98cdb6
#include "gtkalias.h"
Packit 98cdb6
Packit 98cdb6
typedef GtkCellEditableIface GtkCellEditableInterface;
Packit 98cdb6
G_DEFINE_INTERFACE(GtkCellEditable, gtk_cell_editable, GTK_TYPE_WIDGET)
Packit 98cdb6
Packit 98cdb6
static void
Packit 98cdb6
gtk_cell_editable_default_init (GtkCellEditableInterface *iface)
Packit 98cdb6
{
Packit 98cdb6
  /**
Packit 98cdb6
   * GtkCellEditable:editing-canceled:
Packit 98cdb6
   *
Packit 98cdb6
   * Indicates whether editing on the cell has been canceled.
Packit 98cdb6
   *
Packit 98cdb6
   * Since: 2.20
Packit 98cdb6
   */
Packit 98cdb6
  g_object_interface_install_property (iface,
Packit 98cdb6
                                       g_param_spec_boolean ("editing-canceled",
Packit 98cdb6
                                       P_("Editing Canceled"),
Packit 98cdb6
                                       P_("Indicates that editing has been canceled"),
Packit 98cdb6
                                       FALSE,
Packit 98cdb6
                                       GTK_PARAM_READWRITE));
Packit 98cdb6
Packit 98cdb6
  /**
Packit 98cdb6
   * GtkCellEditable::editing-done:
Packit 98cdb6
   * @cell_editable: the object on which the signal was emitted
Packit 98cdb6
   *
Packit 98cdb6
   * This signal is a sign for the cell renderer to update its
Packit 98cdb6
   * value from the @cell_editable.
Packit 98cdb6
   *
Packit 98cdb6
   * Implementations of #GtkCellEditable are responsible for
Packit 98cdb6
   * emitting this signal when they are done editing, e.g.
Packit 98cdb6
   * #GtkEntry is emitting it when the user presses Enter.
Packit 98cdb6
   *
Packit 98cdb6
   * gtk_cell_editable_editing_done() is a convenience method
Packit 98cdb6
   * for emitting GtkCellEditable::editing-done.
Packit 98cdb6
   */
Packit 98cdb6
  g_signal_new (I_("editing-done"),
Packit 98cdb6
                GTK_TYPE_CELL_EDITABLE,
Packit 98cdb6
                G_SIGNAL_RUN_LAST,
Packit 98cdb6
                G_STRUCT_OFFSET (GtkCellEditableIface, editing_done),
Packit 98cdb6
                NULL, NULL,
Packit 98cdb6
                _gtk_marshal_VOID__VOID,
Packit 98cdb6
                G_TYPE_NONE, 0);
Packit 98cdb6
Packit 98cdb6
  /**
Packit 98cdb6
   * GtkCellEditable::remove-widget:
Packit 98cdb6
   * @cell_editable: the object on which the signal was emitted
Packit 98cdb6
   *
Packit 98cdb6
   * This signal is meant to indicate that the cell is finished
Packit 98cdb6
   * editing, and the widget may now be destroyed.
Packit 98cdb6
   *
Packit 98cdb6
   * Implementations of #GtkCellEditable are responsible for
Packit 98cdb6
   * emitting this signal when they are done editing. It must
Packit 98cdb6
   * be emitted after the #GtkCellEditable::editing-done signal,
Packit 98cdb6
   * to give the cell renderer a chance to update the cell's value
Packit 98cdb6
   * before the widget is removed.
Packit 98cdb6
   *
Packit 98cdb6
   * gtk_cell_editable_remove_widget() is a convenience method
Packit 98cdb6
   * for emitting GtkCellEditable::remove-widget.
Packit 98cdb6
   */
Packit 98cdb6
  g_signal_new (I_("remove-widget"),
Packit 98cdb6
                GTK_TYPE_CELL_EDITABLE,
Packit 98cdb6
                G_SIGNAL_RUN_LAST,
Packit 98cdb6
                G_STRUCT_OFFSET (GtkCellEditableIface, remove_widget),
Packit 98cdb6
                NULL, NULL,
Packit 98cdb6
                _gtk_marshal_VOID__VOID,
Packit 98cdb6
                G_TYPE_NONE, 0);
Packit 98cdb6
}
Packit 98cdb6
Packit 98cdb6
/**
Packit 98cdb6
 * gtk_cell_editable_start_editing:
Packit 98cdb6
 * @cell_editable: A #GtkCellEditable
Packit 98cdb6
 * @event: (allow-none): A #GdkEvent, or %NULL
Packit 98cdb6
 * 
Packit 98cdb6
 * Begins editing on a @cell_editable. @event is the #GdkEvent that began 
Packit 98cdb6
 * the editing process. It may be %NULL, in the instance that editing was 
Packit 98cdb6
 * initiated through programatic means.
Packit 98cdb6
 **/
Packit 98cdb6
void
Packit 98cdb6
gtk_cell_editable_start_editing (GtkCellEditable *cell_editable,
Packit 98cdb6
				 GdkEvent        *event)
Packit 98cdb6
{
Packit 98cdb6
  g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
Packit 98cdb6
Packit 98cdb6
  (* GTK_CELL_EDITABLE_GET_IFACE (cell_editable)->start_editing) (cell_editable, event);
Packit 98cdb6
}
Packit 98cdb6
Packit 98cdb6
/**
Packit 98cdb6
 * gtk_cell_editable_editing_done:
Packit 98cdb6
 * @cell_editable: A #GtkTreeEditable
Packit 98cdb6
 * 
Packit 98cdb6
 * Emits the #GtkCellEditable::editing-done signal. 
Packit 98cdb6
 **/
Packit 98cdb6
void
Packit 98cdb6
gtk_cell_editable_editing_done (GtkCellEditable *cell_editable)
Packit 98cdb6
{
Packit 98cdb6
  g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
Packit 98cdb6
Packit 98cdb6
  g_signal_emit_by_name (cell_editable, "editing-done");
Packit 98cdb6
}
Packit 98cdb6
Packit 98cdb6
/**
Packit 98cdb6
 * gtk_cell_editable_remove_widget:
Packit 98cdb6
 * @cell_editable: A #GtkTreeEditable
Packit 98cdb6
 * 
Packit 98cdb6
 * Emits the #GtkCellEditable::remove-widget signal.  
Packit 98cdb6
 **/
Packit 98cdb6
void
Packit 98cdb6
gtk_cell_editable_remove_widget (GtkCellEditable *cell_editable)
Packit 98cdb6
{
Packit 98cdb6
  g_return_if_fail (GTK_IS_CELL_EDITABLE (cell_editable));
Packit 98cdb6
Packit 98cdb6
  g_signal_emit_by_name (cell_editable, "remove-widget");
Packit 98cdb6
}
Packit 98cdb6
Packit 98cdb6
#define __GTK_CELL_EDITABLE_C__
Packit 98cdb6
#include "gtkaliasdef.c"