Re: [gtk-list] "Parent" comment and font question




On Thu, 2 Dec 1999, Matthew D Allen wrote:
> 
> 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:
>

[entering pedantic mode...] accessor functions are simply a feature of an
abstract data type, which is a much simpler and more basic concept than
"object oriented programming" ;-) I screwed this up in my book and
Federico pointed out that it's fuzzy thinking - my theory is it's caused
because many people learned abstract data types when they made the
transition from C/Pascal to C++/ObjC/Java.
 
> Am I missing something?  Just a suggestion - I'd like to see a function
> like that.
>

You're probably right that it would be nice to have a function.

However, I wouldn't feel too bad about accessing it directly; it's fairly
unlikely to change unless a bunch of other stuff breaks in a worse way.

> 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?
> 

This sucks in X; the new Pango/GScript text framework is supposed to
provide a nice abstraction layer to save us from it.

Basically you have to take the XLFD (see my book or the Xlib book or run
xfontsel/gfontsel) and modify the string to have the word "bold" in it,
then try to load that font. Gnumeric probably uses the gnome-print library
as an abstraction layer to avoid this mess. The AbiWord people go further
and just use Type 1 fonts I think.

Havoc



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