Hi all,
I want to modify the default style (enlarge the font) of a gtkmm application
(gtkmm 2, not 3). I was expecting that if I modified the style of the toplevel
window, the modification would be propagated down to its children. But that
doesn't seem to happen.
See the attached example: calling modify_font on a label does indeed produce
the desired effect. Calling it on the main window, however, does nothing --
only the first label's font is enlarged.
Can you please tell me how to change the style of all an application's widgets
at once?
Thank you
Gerardo
#include <gtkmm.h>
class MainWindow : public Gtk::Window
{
private:
Gtk::HBox hbox;
Gtk::Label label1, label2;
public:
MainWindow();
};
MainWindow::MainWindow()
{
add(hbox);
hbox.pack_start(label1, Gtk::PACK_SHRINK);
label1.set_label(" Label 1 ");
hbox.pack_start(label2, Gtk::PACK_SHRINK);
label2.set_label(" Label 2 ");
show_all_children();
// try changing font size
Pango::FontDescription fd = get_pango_context()->get_font_description();
fd.set_size(fd.get_size() * 2);
label1.modify_font(fd); // change label style directly: ok
modify_font(fd); // change parent window style: doesn't propagate to children
}
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
MainWindow window;
Gtk::Main::run(window);
return 0;
}
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list