Re: Add a close button to a Notebook Tab



Try this:

http://gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1Notebook.html#9cc1f87301aa22ca9dc14f86f29db6a4

The first parameter being the notebook page, the second being the widget (in your case an HBox).

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.

Lucas

2007/8/5, Peter Cruickshank <peter petercruickshank ca <mailto:peter petercruickshank ca>>:

    Hey, I just had an idea about that. First, I used glade, so you should
    either use glade, or translate my idea into non-glade-ese yourself.
    But here is what I did:

    In glade2, I made a gtk project, and added a notebook with 3 tabs to
    it. Then I right clicked one fo the tab labels, and hit "delete"...
    this left a blank tab. Inside the blank tab, I made an hbox with 2
    parts. On the left, I put a label, and on the right I put a
    button. In
    the button properties window, I picked Icon: "gtk-close". This created
    a close button on the tab, but it was still too big for a normal tab
    button. In the window preview, I clicked on the the close button, and
    it opened the properties dialog to the properties of "image1" (which
    was strange, since image1 wasn't in the widget tree view..). In the
    image properties I selected Icon Size "menu"... and tada! it looks to
    me just like the official close buttons on the tabs in gedit and other
    programs.

    Again, I just tried this out in glade2, and I am not really familiar
    with gtkmm or programming in general, so if you don't like glade
    you'll have to work backwards... but this technique seems to produce
    nice results.

    Peter

    On 8/5/07, Lucas van Dijk <luckyluke56 gmail com
    <mailto:luckyluke56 gmail com>> wrote:
    > Hi,
    >
    > Got a question again. =) I want a close button on each Tab of a
    certain
    > notebook. But I can't figure it out how. I've searched for a
    while but I
    > couldn't find any example.
    >
    > Something I did found was a python script, which had a close
    button on each
    > tab. So I looked into the source, and saw it has a custom class,
    inherited
    > from an EventBox, which they add to the notebook, but I don't
    think that
    > works with C++.
    >
    > Anyone know how I can do this?
    >
    > Thanks in advance,
    > --
    > Lucas
    > _______________________________________________
    > gtkmm-list mailing list
    > gtkmm-list gnome org <mailto:gtkmm-list gnome org>
    > http://mail.gnome.org/mailman/listinfo/gtkmm-list
    >
    >




--
Lucas
------------------------------------------------------------------------

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list




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