Re: Gtk::Button with custom icon and label



gallows wrote:
> Hi there!
> Well, I want create a custom button. I've tried this:
> 
> 	Gtk::HBox* hbox0 = new Gtk::HBox(false, 0);
>          Gtk::Label* label0 = new Gtk::Label("_Preview", true);
>          Gtk::Image* image0 = new Gtk::Image(Gtk::Stock::YES,
>                                              Gtk::ICON_SIZE_MENU);
>          hbox0->pack_start(*image0);
>          hbox0->pack_start(*label0, true, true, 5);
>          button_preview.add(*hbox0);
> 
> It works, but there is a memory leak...
> Should I use RefPtr<>? If yes, how?

Use manage().  Like manage (new Gtk::Label ("_Preview", true)).

Paul



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