settings/src/gtkPincodeEntry.h File Reference

content lister - Input Pincode Entry More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _GtkPincodeEntry
struct  _GtkPincodeEntryClass

Defines

#define PINCODE_UI_MIN_LENGTH   4
#define PINCODE_UI_MAX_LENGTH   4
#define PINCODE_INPUT_ENTRY_WIDTH   150
#define PINCODE_INPUT_ENTRY_HEIGHT   30
#define GTK_PINCODE_ENTRY_TYPE   (gtk_pincode_entry_get_type ())
#define GTK_PINCODE_ENTRY(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_PINCODE_ENTRY_TYPE, GtkPincodeEntry))
#define GTK_PINCODE_ENTRY_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_PINCODE_ENTRY_TYPE, GtkPincodeEntryClass))
#define IS_GTK_PINCODE_ENTRY(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_PINCODE_ENTRY_TYPE))
#define IS_GTK_PINCODE_ENTRY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_PINCODE_ENTRY_TYPE))

Typedefs

typedef struct _GtkPincodeEntry GtkPincodeEntry
typedef struct
_GtkPincodeEntryClass 
GtkPincodeEntryClass

Functions

GtkWidget * gtk_pincode_entry_new ()
GType gtk_pincode_entry_get_type (void)
gboolean gtk_pincode_entry_check_text (GtkPincodeEntry *pincode_entry)


Detailed Description

content lister - Input Pincode Entry

Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.

override the standard GtkEntry

input pincode entry, limited between 4-8 digital numbers characters are shown as '********' call displayMgr to show the user's input to user on eink screen

Definition in file gtkPincodeEntry.h.


Define Documentation

#define GTK_PINCODE_ENTRY ( obj   )     (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_PINCODE_ENTRY_TYPE, GtkPincodeEntry))

Definition at line 49 of file gtkPincodeEntry.h.

#define GTK_PINCODE_ENTRY_CLASS ( klass   )     (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_PINCODE_ENTRY_TYPE, GtkPincodeEntryClass))

Definition at line 50 of file gtkPincodeEntry.h.

#define GTK_PINCODE_ENTRY_TYPE   (gtk_pincode_entry_get_type ())

Definition at line 48 of file gtkPincodeEntry.h.

#define IS_GTK_PINCODE_ENTRY ( obj   )     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_PINCODE_ENTRY_TYPE))

Definition at line 51 of file gtkPincodeEntry.h.

#define IS_GTK_PINCODE_ENTRY_CLASS ( klass   )     (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_PINCODE_ENTRY_TYPE))

Definition at line 52 of file gtkPincodeEntry.h.

#define PINCODE_INPUT_ENTRY_HEIGHT   30

Definition at line 46 of file gtkPincodeEntry.h.

#define PINCODE_INPUT_ENTRY_WIDTH   150

Definition at line 45 of file gtkPincodeEntry.h.

#define PINCODE_UI_MAX_LENGTH   4

Definition at line 43 of file gtkPincodeEntry.h.

#define PINCODE_UI_MIN_LENGTH   4

Definition at line 42 of file gtkPincodeEntry.h.


Typedef Documentation

Definition at line 54 of file gtkPincodeEntry.h.

Definition at line 55 of file gtkPincodeEntry.h.


Function Documentation

gboolean gtk_pincode_entry_check_text ( GtkPincodeEntry pincode_entry  ) 

check user input is valid or not, should be 4-8 digital numbers

Parameters:
pincode_entry the GtkPincodeEntry widget
Returns:
-TRUE valid pincode string, FALSE invalid pincode string

Definition at line 120 of file gtkPincodeEntry.c.

00121 {
00122     const gchar *text = NULL;
00123     int i, len;
00124     gboolean entry_ok = FALSE;
00125 
00126     g_return_val_if_fail((pincode_entry!= NULL), FALSE);
00127     g_return_val_if_fail(IS_GTK_PINCODE_ENTRY(pincode_entry), FALSE);
00128 
00129     GtkEntry* entry = (GtkEntry*)pincode_entry;
00130 
00131     text = gtk_entry_get_text(entry);
00132     if (text == NULL)
00133     {
00134         text = "";
00135     }
00136 
00137     len = strlen(text);
00138     if (   len >= PINCODE_UI_MIN_LENGTH
00139         && len <= PINCODE_UI_MAX_LENGTH )
00140     {
00141         entry_ok = TRUE;
00142         for (i = 0; i < len; i++)
00143         {
00144             if ( !isdigit(text[i]) )
00145             {
00146                 entry_ok = FALSE;
00147             }
00148         }
00149     }
00150 
00151     return entry_ok;
00152 }

GType gtk_pincode_entry_get_type ( void   ) 

returns type of GtkPincodeEntry widget

Returns:
type

Definition at line 73 of file gtkPincodeEntry.c.

00074 {
00075     static GType pincode_entry_type = 0;
00076 
00077     if (!pincode_entry_type)
00078     {
00079         static const GTypeInfo pincode_entry_info = {
00080             sizeof(GtkPincodeEntryClass),
00081             NULL,               /* base_init */
00082             NULL,               /* base_finalize */
00083             (GClassInitFunc) gtk_pincode_entry_class_init,
00084             NULL,               /* class_finalize */
00085             NULL,               /* class_data */
00086             sizeof(GtkPincodeEntry),
00087             0,                  /* n_preallocs */
00088             (GInstanceInitFunc) gtk_pincode_entry_init,
00089         };
00090 
00091         pincode_entry_type = g_type_register_static(ERGTK_ENTRY_TYPE, "PincodeEntry", &pincode_entry_info, 0);
00092     }
00093     return pincode_entry_type;
00094 }

Here is the call graph for this function:

GtkWidget* gtk_pincode_entry_new (  ) 

creates a new GtkPincodeEntry widget

Parameters:
- 
Returns:
reference to created widget

Definition at line 66 of file gtkPincodeEntry.c.

00067 {
00068     GtkPincodeEntry* pincode_entry = (GtkPincodeEntry*) g_object_new(GTK_PINCODE_ENTRY_TYPE, NULL);
00069 
00070     return GTK_WIDGET(pincode_entry);
00071 }


Generated on Sun Dec 14 17:16:58 2008 by  doxygen 1.5.6