Re: gtkentry subclass
- From: "Padraig O'Briain" <Padraig Obriain Sun COM>
- To: gtk-devel-list gnome org, feiguin magnet fsu edu
- Subject: Re: gtkentry subclass
- Date: Wed, 29 May 2002 17:33:56 +0100 (BST)
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]