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
29namespace fawkes {
30
31class TwoLinesCellRenderer : public Gtk::CellRenderer
32{
33public:
35 virtual ~TwoLinesCellRenderer();
36
37#ifdef GLIBMM_PROPERTIES_ENABLED
38 // Properties
39 Glib::PropertyProxy<Glib::ustring> property_line1();
40 Glib::PropertyProxy<Glib::ustring> property_line2();
41 Glib::PropertyProxy<bool> property_line2_enabled();
42#endif
43
44protected:
45#if GTK_VERSION_GE(3, 0)
46 virtual void
47 get_preferred_width_vfunc(Gtk::Widget &widget, int &minimum_width, int &natural_width) const;
48 virtual void
49 get_preferred_height_vfunc(Gtk::Widget &widget, int &minimum_height, int &natural_height) const;
50 virtual void get_size(Gtk::Widget &widget, int *width, int *height) const;
51 virtual void render_vfunc(const Cairo::RefPtr<Cairo::Context> &cr,
52 Gtk::Widget & widget,
53 const Gdk::Rectangle & background_area,
54 const Gdk::Rectangle & cell_area,
55 Gtk::CellRendererState flags);
56#else
57 virtual void get_size_vfunc(Gtk::Widget & widget,
58 const Gdk::Rectangle *cell_area,
59 int * x_offset,
60 int * y_offset,
61 int * width,
62 int * height) const;
63 virtual void render_vfunc(const Glib::RefPtr<Gdk::Drawable> &window,
64 Gtk::Widget & widget,
65 const Gdk::Rectangle & background_area,
66 const Gdk::Rectangle & cell_area,
67 const Gdk::Rectangle & expose_area,
68 Gtk::CellRendererState flags);
69#endif
70
71private:
72#ifdef GLIBMM_PROPERTIES_ENABLED
73 Glib::Property<Glib::ustring> property_line1_;
74 Glib::Property<Glib::ustring> property_line2_;
75 Glib::Property<bool> property_line2_enabled_;
76#endif
77};
78
79} // end namespace fawkes
80
81#endif
Gtk cell renderer for two lines of text in a cell.
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 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.
virtual ~TwoLinesCellRenderer()
Destructor.
Fawkes library namespace.