//--------------------------------------------------------------------------------
void DbMySQLTableEditorIndexPage::set_value(const Gtk::TreeModel::iterator& iter, int column, GType type, const Glib::ValueBase& value)
{
  bec::IndexColumnsListBE *columns_be = _be->get_indexes()->get_columns();
  bec::NodeId node(_indexes_columns_model->node_for_iter(iter));

  if ( node.is_valid() )
  {
    switch ( column )
    {
      case -2:
      {
        Glib::Value<std::string>   v;
        v.init(value.gobj());
    
        columns_be->set_field(node, ::bec::IndexColumnsListBE::Descending, v.get() == "ASC" ? 0 : 1);
        break;
      }
      case -8:
      {
        Glib::Value<bool>   v;
        v.init(value.gobj());
        columns_be->set_column_enabled(node, v.get());
        recreate_order_model();
        break;
      }
    }
  }
}
Exemple #2
0
void HierTreeMdl::get_value_vfunc(const TreeModel::iterator& iter, int column, Glib::ValueBase& value) const
{
    if (IsIterValid(iter)) {
	if (column < iColRec.size()) {
	    GType coltype = get_column_type_vfunc(column);
	    if (column == HierTreeClrec::KCol_Name) {
		Glib::Value<Glib::ustring> sval;
		sval.init(coltype);
		Elem* node = (Elem*) iter.gobj()->user_data;
		//string data = node->EType() + ":" + node->Name();
		string data = node->Name();
		sval.set(data.c_str());
		value.init(coltype);
		value = sval;
	    }
	    else if (column == HierTreeClrec::KCol_Elem) {
		Glib::Value<Elem*> sval;
		sval.init(coltype);
		Elem* data = (Elem*) iter.gobj()->user_data;
		sval.set(data);
		value.init(coltype);
		value = sval;
	    }
	}
    }
}
//------------------------------------------------------------------------------
void ListModelWrapper::set_value_impl(const iterator& row, int column, const Glib::ValueBase& value)
{
  if (!*_tm)
    return;

  bec::NodeId node(node_for_iter(row));

  if ( node.is_valid() )
  {
    const GType type = *(_columns.types() + column);
    column = _columns.ui2bec(column);

    if ( column < 0 )
    {
      if ( !_fake_column_value_setter.empty() )
        _fake_column_value_setter(row, column, type, value);
    }
    else
    {
      switch ( type )
      {
      case G_TYPE_BOOLEAN:
        {
          Glib::Value<bool>   v;
          v.init(value.gobj());
          lmwdprint("LMW::set_value_impl:%s node %s, column %i, value %i\n", _name.c_str(), node.repr().c_str(), column, v.get());
          (*_tm)->set_field(node, column, (ssize_t)v.get());
          break;
        }
      case G_TYPE_INT:
      case G_TYPE_UINT:
        {
          Glib::Value<ssize_t>   v;
          v.init(value.gobj());
          lmwdprint("LMW::set_value_impl: node %s, column %i, value %i\n", node.repr().c_str(), column, v.get());
          (*_tm)->set_field(node, column, v.get());
          break;
        }
      case G_TYPE_FLOAT:
      case G_TYPE_DOUBLE:
        {
          Glib::Value<double>  v;
          v.init(value.gobj());
          (*_tm)->set_field(node, column, v.get());
          break;
        }
      case G_TYPE_STRING:
        {
          Glib::Value<std::string>   v;
          v.init(value.gobj());
          (*_tm)->set_field(node, column, v.get());
          lmwdprint("LMW::set_value: %s '%s'\n", _name.c_str(), v.get().c_str());
          break;
        }
      default:
        break;
      }
    }
  }
}
Exemple #4
0
 Panel::Panel (workspace::PanelManager& panelManager
              ,Gdl::DockItem& dockItem
              ,const gchar* longName
              ,const gchar* stockID)
   : panelManager_(panelManager)
   , dockItem_(dockItem)
   , panelBar_(*this, stockID)
   {
     // Set dockItems long-name property
     Glib::Value<std::string> val;
     val.init(val.value_type());
     val.set(longName);
     g_object_set_property (G_OBJECT (dockItem.gobj()), "long-name", val.gobj());
     
     /* Set the grip handle */
     GdlDockItemGrip *grip = GDL_DOCK_ITEM_GRIP(
       gdl_dock_item_get_grip(dockItem.gobj()));
     gdl_dock_item_grip_show_handle(grip);
     gdl_dock_item_grip_set_label(grip, ((Widget&)panelBar_).gobj());
     //gdl_dock_item_grip_set_cursor_type(grip, GDK_LEFT_PTR);
     
     /* Set up the panel body */
     // Add this panel's container to the DockItem
     dockItem.add((Gtk::Widget&)*this);
     
     /* Connect the signals */
     dockItem.signal_hide().connect(
         sigc::mem_fun(*this, &Panel::on_item_hidden));
     
     dockItem.show();
   }
Exemple #5
0
void NatnTreeMdl::get_value_vfunc(const TreeModel::iterator& iter, int column, Glib::ValueBase& value) const
{
    if (IsIterValid(iter)) {
	if (column < iColRec.size()) {
	    GType coltype = get_column_type_vfunc(column);
	    Glib::Value<Glib::ustring> sval;
	    sval.init(coltype);
	    string data = iNodesInfo.at(GetRowIndex(iter));
	    sval.set(data.c_str());
	    value.init(coltype);
	    value = sval;
	}
    }
}
//------------------------------------------------------------------------------
void ListModelWrapper::get_icon_value(const iterator& iter, int column, const bec::NodeId& node,
                                      Glib::ValueBase& value) const {
  if (!*_tm)
    return;

  static ImageCache* pixbufs = ImageCache::get_instance();
  static Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default();
  bec::IconId icon_id = (*_tm)->get_field_icon(node, column, get_icon_size());
  value.init(Glib::Value<Glib::RefPtr<Gdk::Pixbuf>>::value_type());
  if (icon_id != 0 && icon_id != -1) {
    Glib::RefPtr<Gdk::Pixbuf> pixbuf = pixbufs->image(icon_id);
    if (pixbuf) {
      Glib::Value<Glib::RefPtr<Gdk::Pixbuf>> pixbufValue;
      pixbufValue.init(Glib::Value<Glib::RefPtr<Gdk::Pixbuf>>::value_type());
      pixbufValue.set(pixbuf);
      value = pixbufValue;
    }
  }
}