Fawkes API  Fawkes Development Version
twolines_cellrenderer.h
1 
2 /***************************************************************************
3  * twolines_cellrenderer.h - Gtk rell renderer for two lines of text
4  *
5  * Created: Sat Nov 29 16:34:03 2008
6  * Copyright 2008-2011 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __LIBS_GUI_UTILS_TWOLINES_CELLRENDERER_H_
25 #define __LIBS_GUI_UTILS_TWOLINES_CELLRENDERER_H_
26 
27 #include <gtkmm.h>
28 
29 namespace fawkes {
30 #if 0 /* just to make Emacs auto-indent happy */
31 }
32 #endif
33 
34 class TwoLinesCellRenderer : public Gtk::CellRenderer
35 {
36  public:
38  virtual ~TwoLinesCellRenderer();
39 
40 #ifdef GLIBMM_PROPERTIES_ENABLED
41  // Properties
42  Glib::PropertyProxy<Glib::ustring> property_line1();
43  Glib::PropertyProxy<Glib::ustring> property_line2();
44  Glib::PropertyProxy<bool> property_line2_enabled();
45 #endif
46 
47  protected:
48 #if GTK_VERSION_GE(3,0)
49  virtual void get_preferred_width_vfunc(Gtk::Widget &widget,
50  int &minimum_width,
51  int &natural_width) const;
52  virtual void get_preferred_height_vfunc(Gtk::Widget &widget,
53  int &minimum_height,
54  int &natural_height) const;
55  virtual void get_size(Gtk::Widget& widget, int *width, int *height) const;
56  virtual void render_vfunc (const Cairo::RefPtr<Cairo::Context> &cr,
57  Gtk::Widget& widget,
58  const Gdk::Rectangle& background_area,
59  const Gdk::Rectangle& cell_area,
60  Gtk::CellRendererState flags);
61 #else
62  virtual void get_size_vfunc (Gtk::Widget& widget,
63  const Gdk::Rectangle* cell_area,
64  int* x_offset, int* y_offset,
65  int* width, int* height) const;
66  virtual void render_vfunc (const Glib::RefPtr<Gdk::Drawable>& window,
67  Gtk::Widget& widget,
68  const Gdk::Rectangle& background_area,
69  const Gdk::Rectangle& cell_area,
70  const Gdk::Rectangle& expose_area,
71  Gtk::CellRendererState flags);
72 #endif
73 
74  private:
75 #ifdef GLIBMM_PROPERTIES_ENABLED
76  Glib::Property<Glib::ustring> __property_line1;
77  Glib::Property<Glib::ustring> __property_line2;
78  Glib::Property<bool> __property_line2_enabled;
79 #endif
80 };
81 
82 } // end namespace fawkes
83 
84 #endif
Gtk cell renderer for two lines of text in a cell.
Fawkes library namespace.
virtual void render_vfunc(const Glib::RefPtr< Gdk::Drawable > &window, Gtk::Widget &widget, const Gdk::Rectangle &background_area, const Gdk::Rectangle &cell_area, const Gdk::Rectangle &expose_area, Gtk::CellRendererState flags)
Render the cell.
virtual ~TwoLinesCellRenderer()
Destructor.
virtual void get_size_vfunc(Gtk::Widget &widget, const Gdk::Rectangle *cell_area, int *x_offset, int *y_offset, int *width, int *height) const
Get required size for cell.