"Parent" comment and font question




It seems sort of strange that gtkwidget.h provides "accessor" methods for
most of the items within a GtkWidget ala OOP, but it doesn't seem to have
one for the *parent node within a widget.  I.e. I came across a spot where
I would want to know if a given widget was the child of a GtkNotebook, and
I wrote:

int is_child_of_notebook(GtkWidget *input){
	GtkWidget *ptr;
	if(!input) return(0);
	ptr = input->parent;
	while(ptr){
		if(GTK_IS_NOTEBOOK(ptr)) return(1);
		ptr = ptr->parent;
	}
	return(0);
}

I would think that this would be a bad idea, but I don't know of another
way to do it.  I'm accessing a piece of data within the GtkWidget object,
which I thought was a big OOP no-no.  If for some reason the GTK+
developers rename the "parent" item to "foobar" or whatever (I don't have
any clue why they would do that, but for the sake of argument) then my
code would be broken, whereas if there was a

GtkWidget *gtk_widget_get_parent(GtkWidget *something);

avalible, there wouldn't be a problem.  

Am I missing something?  Just a suggestion - I'd like to see a function
like that.

Also a font question:  I'm in a situation where I want to
gtk_text_insert() some stuff, but I want the font to be the same as
default, only bold.  How would  do that?

David Allen

 http://opop.nols.com/ Free Software Development
==========================================================================
Der Horizont vieler Menschen ist ein Kreis mit Radius Null -- und das
nennen sie ihren Standpunkt.
==========================================================================
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'



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