gtkentry subclass



I'm trying to create a gtkentry subclass that would allow to justify the
text (left/right--for numbers/centered). Everything would be much easier
if I could just simply overload the "adjust_scroll" function (if it were
part of the class methods). Instead, I have to practivally copy all the
gtkentry code and overload the gtkeditable interface. However I don't
understand the new strategy of adding interfaces:

      static const GInterfaceInfo editable_info =
       {
         (GInterfaceInitFunc) gtk_entry_editable_init,    /*
interface_init */
         NULL,                                            /*
interface_finalize */
         NULL                                             /*
interface_data */
       };
 
       g_type_add_interface_static (entry_type,
                                    GTK_TYPE_EDITABLE,
                                    &editable_info);

I want to overload the methods:

 static void
 gtk_entry_editable_init (GtkEditableClass *iface)
 {
   iface->do_insert_text = gtk_entry_insert_text; 
   iface->do_delete_text = gtk_entry_delete_text;
   iface->insert_text = gtk_entry_real_insert_text;
   iface->delete_text = gtk_entry_real_delete_text;
   iface->get_chars = gtk_entry_get_chars;
   iface->set_selection_bounds = gtk_entry_set_selection_bounds;
   iface->get_selection_bounds = gtk_entry_get_selection_bounds;
   iface->set_position = gtk_entry_real_set_position;
   iface->get_position = gtk_entry_get_position;
 }

When I just copy and paste (and rename) the code from gtkentry, it keeps
calling the original gtkentry functions before calling the new ones. Any
hits? Thanks a lot!
<ADRIAN>




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