[prev in list] [next in list] [prev in thread] [next in thread]
List: gtk-app-devel
Subject: Re: tuning widgets base size
From: Tomaz Canabrava <tumaix () gmail ! com>
Date: 2009-03-02 15:50:16
Message-ID: 7ebbb4b50903020750u527367dma9d69e8fc597677c () mail ! gmail ! com
[Download RAW message or body]
that`s not GTK, that`s Gtkmm,right?
dynamic_cast in C?!
On Mon, Mar 2, 2009 at 12:19 PM, Garth's KidStuff
<garthskidstuff@gmail.com> wrote:
>> But this doesn't work. What is the right solution of my problem? Finaly I
> want make widgets smaller than default widgets, like
>> toolbox widgets in The GIMP.
>
>
> void LXDialog::ShrinkWidgetFont(
> Gtk::Widget* pCtrl, // [in] Control to shrink the text of
> real scale) // [in] scale factor (should be < 1.0 to shrink control)
> {
> // Different kinds of controls need different sub-objects' font resized
> Gtk::Frame* pFrame = dynamic_cast<Gtk::Frame*>(pCtrl);
> if (NULL != pFrame) // e.g. Frames have label widgets they use to
> display their text
> pCtrl = pFrame->get_label_widget();
> else
> { // ...and radio buttons and check buttons are simply containers with a
> single label child
> Gtk::Bin* pBin = dynamic_cast<Gtk::Bin*>(pCtrl);
> if (NULL != pBin)
> pCtrl = pBin->get_child();
> }
>
> Gtk::Label* pLabel = dynamic_cast<Gtk::Label*>(pCtrl);
> if (NULL != pLabel)
> { // Other controls might not have a label whose font we need to set
> Glib::RefPtr<Pango::Context> pPangoContext =
> pLabel->get_pango_context();
> Pango::FontDescription fontD =
> pPangoContext->get_font_description();
> fontD.set_size((int)(scale * fontD.get_size()));
> pLabel->modify_font(fontD);
> }
>
> --
> Garth Upshaw
> Garth's KidStuff
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
--
Um Computador sem Windows é como um Navio sem dançarinas de Can-Can
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic