Re: Using Stock icons...



Thanks a lot, Guillaume.

It will be very usefull ....

S.

2009/5/19 Guillaume Brocker <guillaume brocker digital-trainers com>:
> Sever P A a écrit :
>>
>> Hello,
>>
>> I just created two buttons for putting the two arrows up & down inside
>> each of them... like this,
>>
>> (...)
>> Gtk::Button m_button_up (Gtk::Stock::GO_UP),
>> Gtk::Button m_button_down (Gtk::Stock::GO_DOWN),
>> (...)
>>
>> Doing all this (so, using stock images...), is there any way to quit
>> label texts that appear next to the icons ?
>>
>> S.
>
> Hi !
>
> I've written a very short function to create a button based on an stock item
> but with a customized icon size and label font. I think it will be simple to
> customize this snippet to your need. Here the code :
>
> Gtk::Button * createHugeButton( const Gtk::StockID & stockID )
> {
>  Gtk::Button     * button = new Gtk::Button();
>  Gtk::VBox       * container = Gtk::manage( new Gtk::VBox(false, 5) );
>  Gtk::Image      * image = Gtk::manage( new Gtk::Image() );
>  Gtk::Label      * label = Gtk::manage( new Gtk::Label() );
>  Gtk::StockItem  stockItem;
>
>  Gtk::Stock::lookup( stockID, Gtk::ICON_SIZE_LARGE_TOOLBAR, *image );
>  Gtk::Stock::lookup( stockID, stockItem );
>
>  label->set_text_with_mnemonic( stockItem.get_label() );
>  label->set_mnemonic_widget( *button );
>  label->modify_font( Pango::FontDescription("italic ultralight 15") );
>
>  container->add( *image );
>  container->add( *label );
>  container->set_border_width( 10 );
>  button->add( *container );
>
>  return button;
> }
>
>
> --
> Guillaume
>


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