sub-classing problems



Hi!

I tried to subclass the entry-widget to achieve a secret-entry-widget,
which simply writes spaces or '*'s for the input. My idea was simply to
substitute the gtk_entry_draw_text procedure, but it turned out to be a 
rather difficult affaire, since i have to duplicate every entry procedure
which calls g_e_d_t an so on. As a consequence i have to duplicate nearly
every static procedure in entry.c. Wouldn't it be better to have more
function pointers in GtkEntryClass and to use them from within entry.c ?
With one extra function pointer 'draw-text' in GtkEntryClass and four
substitutions in entry.c like : 

gtk_entry_draw_text (entry); -> 
GTK_ENTRY_CLASS(GTK_OBJECT(entry)->klass)->draw_text(entry);

my work was done. Without this pointer it's easier to copy the the whole 
entry-widget without sub-classing it.
 
bye,
  Lars



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]