[gtkmm] Tooltips in TreeView Headers...



Is there some way to set tooltips for TreeView headers?

I tried to set them many ways. For example, just get widget
from TreeViewColumn and set tooltip for it, next time, i set
custom header to column which was derived from Gtk::EventBox,
and this still not work...

Custom header has it's own window, but this not helped. Every
other part of example's window works fine for tooltips.

Can someone help me with this problem, or point out it's origins,
so i can investigate details myself?

Code attached...

--
fuxx
#include <iostream>
#include <vector>
#include <cstdlib>

#include <gtkmm.h>
#include <atkmm.h>

Gtk::Tooltips *tt;

class CH: public Gtk::EventBox
{
public:
    CH ();
    Gtk::Label m_label;
};

CH::CH ()
    : m_label ("1234567890")
{
//    tt->set_tip (*this, "Label toolip", "Label");
    add ( m_label );
    show_all ();
}

class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:

  ModelColumns()
    { add(m_col_text); add(m_col_number); }

  Gtk::TreeModelColumn<Glib::ustring> m_col_text;
  Gtk::TreeModelColumn<int> m_col_number;
};

class WWW: public Gtk::Window
{
public:
    WWW ();
private:
    CH ch;
    ModelColumns m_Columns;
    Gtk::TreeView m_TreeView;
    Glib::RefPtr<Gtk::ListStore> refListStore;
    Gtk::Button bb;
};

WWW::WWW ()
    : bb ("Hello!")
{
    tt->set_tip (ch/**header*/, "Header tooltip", "Header");
    
    refListStore = Gtk::ListStore::create(m_Columns);
    m_TreeView.set_model(refListStore);
    int coln = m_TreeView.append_column("Messages", m_Columns.m_col_text) - 1;
    Gtk::TreeViewColumn *col = m_TreeView.get_column ( coln );
    col->set_widget ( ch );
    Gtk::TreeModel::Row r = *refListStore->append ();
    r[m_Columns.m_col_text] = "First column";
    
    Gtk::HBox *hb = Gtk::manage ( new Gtk::HBox );
    hb->pack_end (m_TreeView);
    hb->pack_end ( bb );
    add ( *hb );
    
    show_all_children ();

    col->property_clickable () = true;
    tt->set_tip (bb, "Button tooltip", "Button");
    tt->set_tip (m_TreeView, "TreeView tooltip", "TreeView");
}

int main(int argc, char *argv[]) {
    setlocale(LC_ALL, "");
    
    Gtk::Main kit(argc, argv);
    tt = new Gtk::Tooltips ();
    
    WWW window;

    window.show_all ();
    Gtk::Main::run(window);

    return 0;
}


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