Creating a custom Button
- From: Bobby brown <urossec2 yahoo com>
- To: gtkmm-list gnome org
- Subject: Creating a custom Button
- Date: Wed, 15 Jul 2009 23:54:58 -0700 (PDT)
Hello!
I would like to create a custom widget, which wouldl serve as a button and/or as a container. It has to have a different look than the orginal gtk's button, so that it could fit best in an application I am currently trying to develop. Also, the visual aspect of this custom widget should vary, depending on it's current purpose.
What I have done so far is:
1.) Derived my widget from Gtk::Button.
2.) Overriden the on_expose_event method and used cairo for changing the look of the widget.
The thing is, that after connecting the custom widget's (button's) signal_clicked and an appropriate signal handler, the widget performes the desired operation, but...:
a) Because of overriding the on_expose_event method I somehow "loose" the nice button effect
of being pressed down - the button doesn't darken it's colour or moves it's content downwards a bit.
b) Also, I have problems with displaying the custom widget's content (gtk::label) after drawing with cairo in on_expose_event.
Furthermore, I would like to know very much where I could find gtk::Buttons source code that is responsible for drawing, so I could immitate it's predefined visual style. As far as I know, most of the drawing in gtk is nowadays done with the Cairo, that can use GDK's drawables.
Any advice regarding the mentioned issues would be much appreciated!
Regards,
Uros
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]