Determining a custom widget's member functions



    Hello,
	I'm trying to sub-class GtkEditable for a new text widget.

	I can't figure out the relationship between a GtkWidget's class
member functions, and the public API functions for a particular widget.

1	For example, my new text widget will have a function that lets you
set the style of a given range of text:

void       gtk_etext_buffer_set_text_style   (GtkEtextBuffer *buf,
                                        gint              start_pos,
                                        gint              end_pos,
					GtkEtextStyle	  *style);

	Now, assuming this is the only added functionality I've added
beyond the GtkEditable, does this mean that I define my class as:

struct _GtkEtextBufferClass {
  GtkEditableClass parent_class;

  void (* set_text_style)       (GtkEtextBuffer *buf,
	                            gint         start_pos,   
        	                    gint         end_pos,
                                    GtkEtextStyle *style);
};

	What determines whether or not a public API function should also
be a class member function?

	Why, for example, does gtk_font_selection_get_preview_text() exist
but GtkFontSelectionClass does not have a corresponding member function?

	I can see that there are member functions for 

1) Default signal handlers for signals which the widget emits 

2) Bindings actions (I'm still trying to figure this out, too)

3) Some public API functions (i.e., gtk_editable_cut_clipboard() has a
corresponding member function, defined in
gtk_editable_real_cut_clipboard() )

	So what are the criteria for deciding whether or not a public API
function has a corresponding class member function?

	Is it simply that functions which a sub-class would want to
inherit (or override) should be member functions?


Thanks,
Derek Simkowiak
dereks@kd-dev.com



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