[Gtk-sharp-list] Setting HBox background to white

Clark Endrizzi cendrizzi at gmail.com
Mon Nov 14 01:39:05 EST 2005


The sad thing is this is the second time you've mentioned this to me but the
first time I knew so little about GTK that I was unable to put it together.

Well I'm a little smarter (not a lot mind you, GTK is a lot to learn in your
spare time) and while I didn't use an Event Box, I did get it to work with a
view port.

Thanks a lot Fire Rabbit.

-Clark

On 11/13/05, Eric Butler <eric at extremeboredom.net> wrote:
>
> http://eric.extremeboredom.net/2005/01/10/107/
>
> Regards,
> Eric
>
> On 11/13/05, Clark Endrizzi <cendrizzi at gmail.com> wrote:
> > Hi all.
> >
> > In my application I'm trying to set the background of an HBox to white
> > (currently it is the default theme grey and doesn't look good at all). I
> am
> > still very much learning gtk but have asked on IRC and have tried many
> > different things but it doesn't do anything.
> >
> > I have a hbox based class that I'm calling this on the contructor:
> > this.ModifyBase(StateType.Normal, new Gdk.Color(0xff,0xff,0xff));
> >
> > I was hoping it was as easy as specifying the background color like this
> but
> > apparently it isn't (the documentation seems to say this will do this
> trick)
> >
> > I've also tried ModifyBG with no luck. I have just been finding bits and
> > pieces to I'm kinda doing this blindly. For example, I have no idea what
> > those values are that are used to define the color, is there a way to
> simply
> > use RGB (with the normal range used in web development, etc). Could it
> be
> > that the theme overides everything?
> >
> > Libview, from vmware, does something similar but I have no clue how to
> adapt
> > this:
> > bool
> > BaseBGBox::on_expose_event(GdkEventExpose *event) // IN
> > {
> > if (is_drawable()) {
> > const Gtk::Allocation allocation(get_allocation());
> >
> > // Don't cache the gc to avoid worrying about style changes.
> > Glib::RefPtr<Gtk::Style> style = get_style();
> > Gtk::StateType state = get_state();
> > Glib::RefPtr<Gdk::GC> gc;
> > switch (mPalette) {
> > case BASE:
> > gc = style->get_base_gc(state);
> > break;
> > case BG:
> > gc = style->get_bg_gc(state);
> > break;
> > case FG:
> > gc = style->get_fg_gc(state);
> > break;
> > default:
> > g_assert_not_reached();
> > }
> > get_window()->draw_rectangle(gc, true,
> > allocation.get_x(),
> > allocation.get_y(),
> > allocation.get_width(),
> > allocation.get_height ());
> > }
> > return Gtk::HBox::on_expose_event(event);
> > }
> >
> > Instead of using a background color they appear to draw a rectangly,
> kinda
> > seems hackish but it that's whats required...
> >
> > Also within this HBox is also several child vboxes, would I have to set
> each
> > one with their own color too or are HBoxes and VBoxes trasparent by
> default?
> >
> > Thanks a lot!
> > --
> > -Clark Endrizzi
> >
> > _______________________________________________
> > Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> >
> >
> >
>



--
-Clark Endrizzi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20051113/53f33e8c/attachment.html


More information about the Gtk-sharp-list mailing list