[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-devel
Subject:    Re: gtkentry subclass
From:       Adrian Feiguin <feiguin () magnet ! fsu ! edu>
Date:       2002-05-29 17:29:55
[Download RAW message or body]

Sorry, the first methods correspond to the AtkObjectClass, and the second
to the interface. Anyway, what happens to me with the entry is that after
initializing the editable interface (your atk_component interface), the
methods of the parent's editable interface are called before the new ones.
What I want is to overload them, so this shoulnd't happen. What can be
wrong?
<ADRIAN>

On Wed, 29 May 2002, Adrian Feiguin wrote:

> Hi Padraig,
> Let me see: You overload part of the atk class methods in: 
> 
> static void
> gail_window_class_init (GailWindowClass *klass)
> {
>   GailWidgetClass *widget_class;
>   AtkObjectClass  *class = ATK_OBJECT_CLASS (klass);
> 
>   class->get_name = gail_window_get_name;
>   class->get_parent = gail_window_get_parent;
>   class->get_index_in_parent = gail_window_get_index_in_parent;
>   class->ref_state_set = gail_window_ref_state_set;
>   class->initialize = gail_window_real_initialize;
> 
> but you also initialize some in the function:
> 
> static void
> atk_component_interface_init (AtkComponentIface *iface)
> {
>   g_return_if_fail (iface != NULL);
> 
>   iface->get_extents = gail_window_get_extents;
>   iface->get_size = gail_window_get_size;
> }
> 
> Can you tell me the difference? I guess the first overload the previous
> interface. What's the difference between the parent class interface, and
> the child class interface? Thanks a lot!
> <ADRIAN>
> 
> On Wed, 29 May 2002, Padraig O'Briain wrote:
> 
> > Adrain,
> > 
> > I wanted to do a similar thing in gail.
> > 
> > I have a GailWidget class which implements AtkComponent interface and a  
> > GailWindow class which derives from GailWidget. I wanted to provide a different 
> > implementation in GailWindow for a couple of AtkComponent methods. 
> > 
> > Hopefully, the code in gail/gail/gailwindow.c will show you how I did it.
> > 
> > Padraig
> > 
> > > 
> > > 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>
> > > 
> > > _______________________________________________
> > > gtk-devel-list mailing list
> > > gtk-devel-list@gnome.org
> > > http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> > 
> > 
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> 

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic