AC_PREREQ(2.59)
-AC_INIT([GtkMaskedEntry], [0.0.3], [azagli@libero.it])
+AC_INIT([GtkMaskedEntry], [0.0.4], [azagli@libero.it])
AC_CONFIG_SRCDIR([src/gtkmaskedentry.c])
AM_CONFIG_HEADER(config.h)
GTK_DOC_CHECK(1.0)
-PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
-PKG_CHECK_EXISTS(gladeui-1.0 >= 3.2.0, [GLADEUI_FOUND=yes], [GLADEUI_FOUND=no])
-PKG_CHECK_EXISTS(libgtkform >= 0.2.0, [LIBGTKFORM_FOUND=yes], [LIBGTKFORM_FOUND=no])
+PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0.0)
+PKG_CHECK_EXISTS(gladeui-2.0 >= 3.10.0, [GLADEUI_FOUND=yes], [GLADEUI_FOUND=no])
+PKG_CHECK_EXISTS(libgtkform >= 0.5.0, [LIBGTKFORM_FOUND=yes], [LIBGTKFORM_FOUND=no])
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AM_CONDITIONAL(LIBGTKFORM_FOUND, test $LIBGTKFORM_FOUND = yes)
if test $LIBGTKFORM_FOUND = yes; then
-PKG_CHECK_MODULES(GTKFORM, libgtkform >= 0.2.0)
+PKG_CHECK_MODULES(GTKFORM, libgtkform >= 0.5.0)
AC_SUBST(GTKFORM_CFLAGS)
AC_SUBST(GTKFORM_LIBS)
includedir=@includedir@
Name: @PACKAGE_NAME@
-Description: GTK+ 2.0 Masked Entry Widget
+Description: GTK+ 3.0 Masked Entry Widget
Version: @PACKAGE_VERSION@
-Requires: gtk+-2.0
+Requires: gtk+-3.0
Libs: -L${libdir} -lgtkmaskedentry
Cflags: -I${includedir}
/*
* GtkCellRendererMasked widget for GTK+
- * Copyright (C) 2005-2011 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2005-2014 Andrea Zagli <azagli@libero.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags);
gpointer data)
{
const gchar *path, *new_text;
+
+ gboolean editing_canceled;
+
GtkCellRendererMaskedPrivate *priv = GTK_CELL_RENDERER_MASKED_GET_PRIVATE (data);
priv->entry = NULL;
+ g_object_get (G_OBJECT (entry), "editing-canceled", &editing_canceled, NULL);
gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (data),
- GTK_ENTRY (entry)->editing_canceled);
- if (GTK_ENTRY (entry)->editing_canceled)
+ editing_canceled);
+ if (editing_canceled)
return;
path = g_object_get_data (G_OBJECT (entry), GTK_CELL_RENDERER_TEXT_PATH);
GdkEvent *event,
GtkWidget *widget,
const gchar *path,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
+ const GdkRectangle *background_area,
+ const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
GtkCellRendererMasked *celltext;
GtkCellRendererMaskedPrivate *priv;
+ gboolean editable;
+ gfloat xalign;
+ gchar *text;
+
celltext = GTK_CELL_RENDERER_MASKED (cell);
priv = GTK_CELL_RENDERER_MASKED_GET_PRIVATE (cell);
/* If the cell isn't editable we return NULL. */
- if (GTK_CELL_RENDERER_TEXT (celltext)->editable == FALSE)
+ g_object_get (G_OBJECT (celltext), "editable", &editable, NULL);
+ if (editable == FALSE)
return NULL;
+ g_object_get (G_OBJECT (cell), "xalign", &xalign, NULL);
priv->entry = g_object_new (GTK_TYPE_MASKED_ENTRY,
"has-frame", FALSE,
- "xalign", cell->xalign,
+ "xalign", xalign,
NULL);
if (priv->mask)
gtk_masked_entry_set_mask (GTK_MASKED_ENTRY (priv->entry), priv->mask);
- if (GTK_CELL_RENDERER_TEXT (celltext)->text)
- gtk_entry_set_text (GTK_ENTRY (priv->entry), GTK_CELL_RENDERER_TEXT (celltext)->text);
+ text = NULL;
+ g_object_get (G_OBJECT (celltext), "text", &text, NULL);
+ if (text)
+ gtk_entry_set_text (GTK_ENTRY (priv->entry), text);
g_object_set_data_full (G_OBJECT (priv->entry), GTK_CELL_RENDERER_TEXT_PATH, g_strdup (path), g_free);
/*
* GtkMaskedEntry widget for GTK+
- * Copyright (C) 2005-2011 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2005-2014 Andrea Zagli <azagli@libero.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
GtkMaskedEntry *masked_entry = GTK_MASKED_ENTRY (user_data);
GtkMaskedEntryPrivate *priv = GTK_MASKED_ENTRY_GET_PRIVATE (masked_entry);
- if ((event->keyval == GDK_Tab || event->keyval == GDK_ISO_Left_Tab)
+ if ((event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_ISO_Left_Tab)
&& priv->tab_inside)
{
gint pos;
/*
* GtkMaskedEntry widget test
- * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2005-2014 Andrea Zagli <azagli@libero.it>
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
btn_setmask_on_clicked (GtkButton *button,
gpointer user_data)
{
- gtk_masked_entry_set_mask (GTK_MASKED_ENTRY (masked_entry), gtk_combo_box_get_active_text (GTK_COMBO_BOX (txtMask)));
- g_object_set (G_OBJECT (rend), "mask", gtk_combo_box_get_active_text (GTK_COMBO_BOX (txtMask)), NULL);
+ gtk_masked_entry_set_mask (GTK_MASKED_ENTRY (masked_entry), gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (txtMask)));
+ g_object_set (G_OBJECT (rend), "mask", gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (txtMask)), NULL);
}
static void
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, 0, 0, 3, 3);
gtk_widget_show (label);
- txtMask = gtk_combo_box_entry_new_text ();
+ txtMask = gtk_combo_box_text_new_with_entry ();
gtk_table_attach (GTK_TABLE (table), txtMask, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 3, 3);
gtk_widget_show (txtMask);
/* some mask examples */
- gtk_combo_box_append_text (GTK_COMBO_BOX (txtMask), "00/00/0000");
- gtk_combo_box_append_text (GTK_COMBO_BOX (txtMask), "999 999 999"); /* digit excluded 0 */
- gtk_combo_box_append_text (GTK_COMBO_BOX (txtMask), "@@@ @@@ @@@"); /* alpha */
- gtk_combo_box_append_text (GTK_COMBO_BOX (txtMask), "^^^ ^^^ ^^^"); /* alpha to upper case */
- gtk_combo_box_append_text (GTK_COMBO_BOX (txtMask), "ABC 00@@@00");
- gtk_combo_box_append_text (GTK_COMBO_BOX (txtMask), "### some text");
-
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (txtMask), "00/00/0000");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (txtMask), "999 999 999"); /* digit excluded 0 */
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (txtMask), "@@@ @@@ @@@"); /* alpha */
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (txtMask), "^^^ ^^^ ^^^"); /* alpha to upper case */
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (txtMask), "ABC 00@@@00");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (txtMask), "### some text");
+
btnSetMask = gtk_button_new_with_label ("Set Mask");
gtk_table_attach (GTK_TABLE (table), btnSetMask, 2, 3, 0, 1, 0, 0, 3, 3);
gtk_widget_show (btnSetMask);