How to install a new "property"?
- From: dzho002 <zhou_dx yahoo com>
- To: Gtkmm <gtkmm-list gnome org>
- Subject: How to install a new "property"?
- Date: Sun, 27 Mar 2005 06:07:09 -0800 (PST)
Hi,
I want to write a "captioned image" cell renderer
using gtkmm, which can display an image(pixbuf) with a
caption under it in a list view. (as in the preference
dialog of Anjuta). I wrote a class as follows. I need
add an extra property called "text" to the renderer.
My question is how I can install/register the new
property (do I need do that at all?) Is the function,
PropertyBase::install_property, for this purpose?
Thanks.
Dan
-------
class CellRendererCaptionedImage:
public Gtk::CellRendererPixbuf
{
public:
Glib::PropertyProxy<Glib::ustring> property_text() ;
Glib::PropertyProxy_ReadOnly<Glib::ustring>
property_text() const;
CellRendererCaptionedImage();
protected:
virtual void get_size_vfunc(Gtk::Widget& widget, const
Gdk::Rectangle* cell_area, int* x_offset, int*
y_offset, int* width, int* height) const;
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);
private:
Gtk::CellRendererText* m_caption;
};
CellRendererCaptionedImage::CellRendererCaptionedImage():
m_caption(Gtk::manage(new Gtk::CellRendererText()))
{
/*
install_property(g_param_spec_string ("text","Text",
"Caption of the image", NULL,
GParamFlags)G_PARAM_READWRITE));*/
}
Glib::PropertyProxy<Glib::ustring>
CellRendererCaptionedImage::property_text()
{
return Glib::PropertyProxy<Glib::ustring>(m_caption,
"text");
}
Glib::PropertyProxy_ReadOnly<Glib::ustring>
CellRendererCaptionedImage::property_text() const
{
return
Glib::PropertyProxy_ReadOnly<Glib::ustring>(m_caption,
"text");
}
.....
----------------------------------------------------------
Have fun!
__________________________________________________________
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]