// -*- c++ -*-
/* $Id: cellview.ccg,v 1.3 2006/05/10 20:59:27 murrayc Exp $ */

/* 
 *
 * Copyright 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gtkmm/cellrenderertext.h>
#include <gtkmm/cellrendererpixbuf.h>
#include <gtk/gtkcellview.h>

namespace Gtk
{

CellView::CellView(const Glib::ustring& text, bool use_markup)
:
  _CONSTRUCT()
{
  Gtk::CellRendererText* cell = Gtk::manage(new Gtk::CellRendererText());

  if(use_markup)
  {
    #ifdef GLIBMM_PROPERTIES_ENABLED
    cell->property_markup() = text;
    #else
    cell->set_property("markup", text);
    #endif
  }
  else
  {
    #ifdef GLIBMM_PROPERTIES_ENABLED
    cell->property_text() = text;
    #else
    cell->set_property("text", text);
    #endif
  }

  pack_start(*cell);
}

CellView::CellView(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
:
  _CONSTRUCT()
{
  Gtk::CellRendererPixbuf* cell = Gtk::manage(new Gtk::CellRendererPixbuf());

  #ifdef GLIBMM_PROPERTIES_ENABLED
  cell->property_pixbuf() = pixbuf;
  #else
  cell->set_property("pixbuf", (void*)(pixbuf->gobj()));
  #endif

  pack_start(*cell);
}


} //namespace Gtk
