Re: Add a close button to a Notebook Tab
- From: "Grizzly(Francis Smit)" <grizzly smit id au>
- To: gtkmm-list gnome org
- Subject: Re: Add a close button to a Notebook Tab
- Date: Mon, 06 Aug 2007 15:02:04 +1000
Lucas van Dijk wrote:
> Hi,
>
> Thanks for the reply! :) I think there will be any method in gtkmm,
> which allows to add a hbox as the tab label, but I just can't find
> what. I'm using glade too, but I add tabs dynamic, and needs to be
> done through code.
>
>
<snip>
here's what I did to solve this problem in my app :
void MainWin::on_add_page()
{
Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow);
Gtk::TextView* tv = Gtk::manage(new Gtk::TextView);
sw->add(*tv);
Gtk::HBox* hb = Gtk::manage(new Gtk::HBox);
Gtk::Label* l = Gtk::manage(new Gtk::Label("<new file>"));
l->set_text("<new file>");
Gtk::EventBox* e = Gtk::manage(new Gtk::EventBox);
e->add(*l);
hb->pack_start(*e);
Gtk::Button* b = Gtk::manage(new Gtk::Button);
//~ Gtk::Image* i = Gtk::manage(new Gtk::Image("littlecross.png"));
Gtk::Image* i = Gtk::manage(new Gtk::Image(Gtk::Stock::CLOSE,
Gtk::ICON_SIZE_MENU));
b->add(*i);
b->signal_clicked().
connect(sigc::bind<Gtk::ScrolledWindow*>(sigc::mem_fun(*this,
&MainWin::on_cross_clicked), sw) );
hb->pack_start(*b, Gtk::PACK_SHRINK);
Gtk::Label* ml = Gtk::manage(new Gtk::Label);
ml->set_text("<new file>");
m_notebook->append_page(*sw, *hb, *ml);
hb->show_all_children();
m_notebook->show_all_children();
m_Buffs.insert(m_Buffs.end(),
Buffer(this, tv, "", l, sw, ml, hb, m_notebook, b, e,
&m_tooltips));
} // void MainWin::on_add_page() //
--
In my life God comes first.... but Linux is pretty high after that :-D
Grizzly(Francis Smit)
http://www.geekcode.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GM/CS/P/PA d- s+:+> a+>? C++++ UL++++@ P+ L+++ E--- W+++ N+(++) K w--- M-- V-- PS(+) PE(-) Y+(++) PGP++ t+(++) 5 X- R- tv b+++(++++) DI(--) D G e++(+++) h-- r- y-
------END GEEK CODE BLOCK------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]