Re: Creating new widgets




Matthew Braid wrote:
Hi again,

Hmmm. My curiosity is piqued - how does one make a 'fake' button like
SpinButtons? I'm assuming its a Frame with an EventBox and an Arrow, which
sounds simple enough, but then there's themey type things which I'm still a
little hazy on. What would the FakeButton need to know from the theme, and
how would it get that info?

SpinButton gets special help from the theme engine to draw the little buttons.

http://cvs.gnome.org/viewcvs/gtk%2B/gtk/gtkspinbutton.c?rev=1.128&view=markup


Gtk's stock widgets use their style objects to draw their components. 
(Gtk2::Style::paint_box() or Gtk2::Style::paint_arrow(), for example.)  They
also give the theme engine hints, such as "spinbutton_up" or "spinbutton_down"
for gtk_paint_box() in gtk_spin_button_draw_arrow().


So, you have two choices:

1) figure out which portions of the theme support you can hijack and use to
draw your own stuff (possibly just using stock theme options, which may work
fine for you), or

2) just draw it yourself, without theme help (and thus have a widget that
doesn't look quite right on somebody else's desktop).


I know of no useful resources for this; i just Use The Source.  :-/


-- 
muppet <scott at asofyet dot org>




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