Re: problem using pango ...



Actually this->object is a Gtk::Widget.  I'm implementing a class hierarchy using the abstract factory pattern, which means that all widgets should be treated equal in this point where I request to change the widget's text style.  Can I only change widgets that inherit from Gtk::Bin ??

On 10/01/2013 02:25 AM, Kjell Ahlstedt wrote:
Where's the Gtk::Button in your code? Is this->object a Gtk::Button pointer?
A Gtk::Button is a container, a Gtk::Bin. If it shows a text, its child widget is probably a Gtk::Label. You should  try to change the style of the Button's child instead of the style of the Button itself.

Kjell

2013-09-30 17:30, raespi skrev:
Hi ... I'm currently trying to set the font style of a widget from gtkmm.  The code is a bit like this:

Glib::RefPtr< Gtk::Style > s = this->object->get_style();
Pango::FontDescription f = s->get_font();

In a later moment I manage to set the according properties of the Pango::FontDescription object. And end the function's code with:

s->set_font ( f );
this->object->set_style ( s );

At first I thought the code I used to change the properties was incorrect, but I printed the Pango::FontDescription object attributes before setting them and after:

BEFORE: Droid Sans 10
AFTER: Arial Bold Italic 0.029296875

And it seems up to here everything is fine.  Still the Gtk::Button doesn't change it's font style ... Any ideas where I could be wrong ??

Thanks ...







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