Re: Gtk::TreeView && Gtk::ComboBox
- From: Claudio Polegato Junior <cpolegatojr_lsts pop com br>
- To: Alexander <rope-walker yandex ru>
- Cc: "gtkmm-list gnome org" <gtkmm-list gnome org>
- Subject: Re: Gtk::TreeView && Gtk::ComboBox
- Date: Wed, 01 Feb 2006 16:37:52 +0000
Alexander escreveu:
How to devide columns in "View" with line?
Hi,
I am doing this:
// this on header
Class Classe...{
...
bool Expose(GdkEventExpose* Event);
int Draw_Line(Gtk::TreePath Path, Glib::RefPtr<Gdk::Window>
&Window, Glib::RefPtr<Gdk::GC> &GC, Gtk::TreeViewColumn* &Column,
Gdk::Rectangle &Master, Gdk::Rectangle &Rectangle, bool Draw);
...
};
// this on body
Classe::Classe(...){
...
m_Grid.signal_expose_event().connect(SigC::slot(*this,
&Classe::Expose), /*after=*/true);
...
}
int Classe::Draw_Line(Gtk::TreePath Path, Glib::RefPtr<Gdk::Window>
&Window, Glib::RefPtr<Gdk::GC> &GC, Gtk::TreeViewColumn* &Column,
Gdk::Rectangle &Master, Gdk::Rectangle &Rectangle, bool Draw){
int MaxH = 0;
if (!m_TreeModel->get_iter(Path))
return 0;
m_Grid.get_background_area(Path, *Column, Rectangle);
while (m_TreeModel->get_iter(Path) && Rectangle.get_y()<0){
Path.next();
m_Grid.get_background_area(Path, *Column, Rectangle);
}
Path.prev();
m_Grid.get_background_area(Path, *Column, Rectangle);
do{
if (Draw)
Window->draw_line(GC, Master.get_x(), Rectangle.get_y(),
Master.get_x()+Master.get_width(), Rectangle.get_y());
if (m_Grid.row_expanded(Path)){
Path.down();
MaxH = Draw_Line(Path, Window, GC, Column, Master, Rectangle);
Path.up();
}
Path.next();
m_Grid.get_background_area(Path, *Column, Rectangle);
} while (m_TreeModel->get_iter(Path) &&
Rectangle.get_y()<=Master.get_height());
Path.prev();
m_Grid.get_background_area(Path, *Column, Rectangle);
if (Rectangle.get_y()+Rectangle.get_height()<=Master.get_height()){
if (MaxH < Rectangle.get_y()+Rectangle.get_height())
MaxH = Rectangle.get_y()+Rectangle.get_height();
if (Draw)
Window->draw_line(GC, Master.get_x(),
Rectangle.get_y()+Rectangle.get_height(),
Master.get_x()+Master.get_width(),
Rectangle.get_y()+Rectangle.get_height());
}
else
MaxH = Master.get_height();
return MaxH;
}
bool Classe::Expose(GdkEventExpose* Event){
int i, MaxH=0, MaxW;
Gdk::Rectangle Master;
m_Grid.get_visible_rect(Master);
if (Master.get_height()<3 || Master.get_width()<3)
return false;
Gtk::TreeViewColumn *Column = m_Grid.get_column(0);
if (!Column)
return false;
Glib::RefPtr<Gdk::Window> Window = m_Grid.get_bin_window();
Glib::RefPtr<Gdk::GC> GC = Gdk::GC::create(Window);
Gdk::Rectangle Rectangle;
Gtk::TreePath Path("0");
MaxH = Draw_Line(Path, Window, GC, Column, Master, Rectangle);
if (!MaxH)
MaxH = Draw_Line(Path, Window, GC, Column, Master, Rectangle, false);
i=1;
while ((Column = m_Grid.get_column(i++))!=0 &&
Rectangle.get_x()<Master.get_x())
m_Grid.get_background_area(Path, *Column, Rectangle);
MaxW = Master.get_x()+Master.get_width()+1;
MaxH--;
while (Column && Rectangle.get_x()<MaxW){
Window->draw_line(GC, Rectangle.get_x(), 0, Rectangle.get_x(), MaxH);
m_Grid.get_background_area(Path, *Column, Rectangle);
Column = m_Grid.get_column(i++);
}
Window->draw_line(GC, Rectangle.get_x(), 0, Rectangle.get_x(), MaxH);
return false;
}
--
[]'s
Claudio Polegato Junior
Um peregrino de Problemas; Um pergaminho de Soluções.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]